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 | c44efa8c2c21a81bb9065146ef464de6b88e0262 (patch) | |
tree | 71eabc9824f21dec8bc82f86a14bbf91d14f9c0f /generic | |
parent | 0d435ca01df07d055e04b8dcd1e3864438bb6d06 (diff) | |
parent | b21d13ee199f28daaeb3a66120cdd34791b860da (diff) | |
download | tcl-c44efa8c2c21a81bb9065146ef464de6b88e0262.zip tcl-c44efa8c2c21a81bb9065146ef464de6b88e0262.tar.gz tcl-c44efa8c2c21a81bb9065146ef464de6b88e0262.tar.bz2 |
Fix several more missing mutex-locks in TestasyncCmd.
Diffstat (limited to 'generic')
-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); |