summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
Diffstat (limited to 'generic')
-rw-r--r--generic/tclInt.h2
-rw-r--r--generic/tclThread.c11
2 files changed, 10 insertions, 3 deletions
diff --git a/generic/tclInt.h b/generic/tclInt.h
index 3f84717..bcf2355 100644
--- a/generic/tclInt.h
+++ b/generic/tclInt.h
@@ -3059,6 +3059,8 @@ MODULE_SCOPE void TclpInitUnlock(void);
MODULE_SCOPE Tcl_Obj * TclpObjListVolumes(void);
MODULE_SCOPE void TclpMasterLock(void);
MODULE_SCOPE void TclpMasterUnlock(void);
+MODULE_SCOPE void TclpMutexLock(void);
+MODULE_SCOPE void TclpMutexUnlock(void);
MODULE_SCOPE int TclpMatchFiles(Tcl_Interp *interp, char *separators,
Tcl_DString *dirPtr, char *pattern, char *tail);
MODULE_SCOPE int TclpObjNormalizePath(Tcl_Interp *interp,
diff --git a/generic/tclThread.c b/generic/tclThread.c
index 64e956a..db326ad 100644
--- a/generic/tclThread.c
+++ b/generic/tclThread.c
@@ -305,12 +305,17 @@ void
Tcl_MutexUnlockAndFinalize(
Tcl_Mutex *mutexPtr)
{
+ Tcl_Mutex mutex;
TclpMasterLock();
+ TclpMutexLock();
#ifdef TCL_THREADS
- Tcl_MutexUnlock(mutexPtr);
- TclpFinalizeMutex(mutexPtr);
+ mutex = *mutexPtr;
+ *mutexPtr = NULL; /* Force it to be created again. */
+ Tcl_MutexUnlock(&mutex);
+ TclpFinalizeMutex(&mutex);
#endif
- ForgetSyncObject(mutexPtr, &mutexRecord);
+ ForgetSyncObject(&mutex, &mutexRecord);
+ TclpMutexUnlock();
TclpMasterUnlock();
}