File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed
Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -709,7 +709,7 @@ ThreadEvalObjCmd(
709709 }
710710
711711 /*
712- * Find out wether to use the internal (recursive) mutex
712+ * Find out whether to use the internal (recursive) mutex
713713 * or external mutex given on the command line, and lock
714714 * the corresponding mutex immediately.
715715 *
@@ -736,11 +736,13 @@ ThreadEvalObjCmd(
736736 return TCL_ERROR ;
737737 }
738738 if (IsReadWrite (mutexPtr )) {
739+ PutMutex (mutexPtr );
739740 Tcl_AppendResult (interp , "wrong mutex type, must be exclusive "
740741 "or recursive" , (void * )NULL );
741742 return TCL_ERROR ;
742743 }
743744 if (!SpMutexLock (mutexPtr )) {
745+ PutMutex (mutexPtr );
744746 Tcl_AppendResult (interp , "locking the same exclusive mutex "
745747 "twice from the same thread" , (void * )NULL );
746748 return TCL_ERROR ;
@@ -782,6 +784,7 @@ ThreadEvalObjCmd(
782784 Sp_RecursiveMutexUnlock (& evalMutex );
783785 } else {
784786 SpMutexUnlock (mutexPtr );
787+ PutMutex (mutexPtr );
785788 }
786789
787790 return ret ;
Original file line number Diff line number Diff line change @@ -1263,6 +1263,11 @@ test thread-22.1 {thread::send -command} {
12631263 set result
12641264} hello
12651265
1266+ test thread-bug-f32864afe3 {Hang in thread::eval -lock} -body {
1267+ set mu [thread::mutex create]
1268+ thread::eval -lock $mu {}
1269+ thread::mutex destroy $mu ; # <- Bug f32864af hang
1270+ } -result {}
12661271
12671272removeFile dummyForTransfer
12681273::tcltest::cleanupTests
You can’t perform that action at this time.
0 commit comments