diff options
| author | Joe Mistachkin <joe@mistachkin.com> | 2012-07-20 01:53:09 (GMT) |
|---|---|---|
| committer | Joe Mistachkin <joe@mistachkin.com> | 2012-07-20 01:53:09 (GMT) |
| commit | 74a30b1f06e05a53b6defbb1df5364b9fc3acec9 (patch) | |
| tree | 71eabc9824f21dec8bc82f86a14bbf91d14f9c0f /generic/tclTest.c | |
| parent | 3eda1b7d5e988dfe60aed31fc65ba276d2e364ca (diff) | |
| parent | e5a91a74e1a7a3db1455eb147b04ec18a0ef702d (diff) | |
| download | tcl-74a30b1f06e05a53b6defbb1df5364b9fc3acec9.zip tcl-74a30b1f06e05a53b6defbb1df5364b9fc3acec9.tar.gz tcl-74a30b1f06e05a53b6defbb1df5364b9fc3acec9.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 3f06be0..bf75a0f 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -870,6 +870,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) { @@ -878,6 +879,7 @@ TestasyncCmd( } } Tcl_SetObjResult(interp, Tcl_NewStringObj(argv[3], -1)); + Tcl_MutexUnlock(&asyncTestMutex); return code; #ifdef TCL_THREADS } else if (strcmp(argv[1], "marklater") == 0) { @@ -887,6 +889,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) { @@ -895,11 +898,13 @@ TestasyncCmd( 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); |
