diff options
author | dgp <dgp@users.sourceforge.net> | 2012-07-24 12:58:19 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2012-07-24 12:58:19 (GMT) |
commit | c4f983261d923f62efa6f19f38ec0df77a179208 (patch) | |
tree | 0798dcd501f39ddd35b38ed5bbb2659c2c764446 /generic/tclTest.c | |
parent | 04a43cfcc84bbb38fb5ef52dd5dc736d7157549a (diff) | |
parent | 28d0e97048a0a5b72d187f1effaca560640d69e3 (diff) | |
download | tcl-c4f983261d923f62efa6f19f38ec0df77a179208.zip tcl-c4f983261d923f62efa6f19f38ec0df77a179208.tar.gz tcl-c4f983261d923f62efa6f19f38ec0df77a179208.tar.bz2 |
merge 8.5
Diffstat (limited to 'generic/tclTest.c')
-rw-r--r-- | generic/tclTest.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/generic/tclTest.c b/generic/tclTest.c index ab0c6cb..8dd315f 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -821,6 +821,7 @@ TestasyncCmd( Tcl_SetResult(interp, buf, TCL_VOLATILE); } else if (strcmp(argv[1], "delete") == 0) { if (argc == 2) { + Tcl_MutexLock(&asyncTestMutex); while (firstHandler != NULL) { asyncPtr = firstHandler; firstHandler = asyncPtr->nextPtr; @@ -828,6 +829,7 @@ TestasyncCmd( ckfree(asyncPtr->command); ckfree((char *) asyncPtr); } + Tcl_MutexUnlock(&asyncTestMutex); return TCL_OK; } if (argc != 3) { @@ -836,6 +838,7 @@ TestasyncCmd( if (Tcl_GetInt(interp, argv[2], &id) != TCL_OK) { return TCL_ERROR; } + Tcl_MutexLock(&asyncTestMutex); for (prevPtr = NULL, asyncPtr = firstHandler; asyncPtr != NULL; prevPtr = asyncPtr, asyncPtr = asyncPtr->nextPtr) { if (asyncPtr->id != id) { @@ -860,6 +863,7 @@ TestasyncCmd( || (Tcl_GetInt(interp, argv[4], &code) != TCL_OK)) { return TCL_ERROR; } + Tcl_MutexLock(&asyncTestMutex); for (asyncPtr = firstHandler; asyncPtr != NULL; asyncPtr = asyncPtr->nextPtr) { if (asyncPtr->id == id) { @@ -867,6 +871,7 @@ TestasyncCmd( break; } } + Tcl_MutexUnlock(&asyncTestMutex); Tcl_SetResult(interp, (char *)argv[3], TCL_VOLATILE); return code; #ifdef TCL_THREADS @@ -877,6 +882,7 @@ TestasyncCmd( if (Tcl_GetInt(interp, argv[2], &id) != TCL_OK) { return TCL_ERROR; } + Tcl_MutexLock(&asyncTestMutex); for (asyncPtr = firstHandler; asyncPtr != NULL; asyncPtr = asyncPtr->nextPtr) { if (asyncPtr->id == id) { @@ -885,11 +891,13 @@ TestasyncCmd( (ClientData) INT2PTR(id), TCL_THREAD_STACK_DEFAULT, TCL_THREAD_NOFLAGS) != TCL_OK) { Tcl_SetResult(interp, "can't create thread", TCL_STATIC); + Tcl_MutexUnlock(&asyncTestMutex); return TCL_ERROR; } break; } } + Tcl_MutexUnlock(&asyncTestMutex); } else { Tcl_AppendResult(interp, "bad option \"", argv[1], "\": must be create, delete, int, mark, or marklater", NULL); |