diff options
author | Joe Mistachkin <joe@mistachkin.com> | 2012-07-20 01:47:48 (GMT) |
---|---|---|
committer | Joe Mistachkin <joe@mistachkin.com> | 2012-07-20 01:47:48 (GMT) |
commit | b21d13ee199f28daaeb3a66120cdd34791b860da (patch) | |
tree | f56e071d117de17b2a8e4fe2268267a267a4fe2e /generic/tclTest.c | |
parent | 3c3496770b84df1308f6cbd90ced02d636cedc04 (diff) | |
download | tcl-b21d13ee199f28daaeb3a66120cdd34791b860da.zip tcl-b21d13ee199f28daaeb3a66120cdd34791b860da.tar.gz tcl-b21d13ee199f28daaeb3a66120cdd34791b860da.tar.bz2 |
Fix several more missing mutex-locks in TestasyncCmd.
Diffstat (limited to 'generic/tclTest.c')
-rw-r--r-- | generic/tclTest.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/generic/tclTest.c b/generic/tclTest.c index 56ea232..8dd315f 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -863,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) { @@ -870,6 +871,7 @@ TestasyncCmd( break; } } + Tcl_MutexUnlock(&asyncTestMutex); Tcl_SetResult(interp, (char *)argv[3], TCL_VOLATILE); return code; #ifdef TCL_THREADS @@ -880,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) { @@ -888,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); |