summaryrefslogtreecommitdiffstats
path: root/generic/tclThread.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tclThread.c')
-rw-r--r--generic/tclThread.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/generic/tclThread.c b/generic/tclThread.c
index 198fa6a..64e956a 100644
--- a/generic/tclThread.c
+++ b/generic/tclThread.c
@@ -50,6 +50,7 @@ static void RememberSyncObject(void *objPtr,
#undef Tcl_MutexLock
#undef Tcl_MutexUnlock
#undef Tcl_MutexFinalize
+#undef Tcl_MutexUnlockAndFinalize
#undef Tcl_ConditionNotify
#undef Tcl_ConditionWait
#undef Tcl_ConditionFinalize
@@ -284,6 +285,38 @@ Tcl_MutexFinalize(
/*
*----------------------------------------------------------------------
*
+ * Tcl_MutexUnlockAndFinalize --
+ *
+ * This procedure is invoked to unlock and then finalize a mutex.
+ * The mutex must have been locked by Tcl_MutexLock. It is also
+ * removed from the list of remembered objects. The mutex can no
+ * longer be used after calling this procedure.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Remove the mutex from the list.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+Tcl_MutexUnlockAndFinalize(
+ Tcl_Mutex *mutexPtr)
+{
+ TclpMasterLock();
+#ifdef TCL_THREADS
+ Tcl_MutexUnlock(mutexPtr);
+ TclpFinalizeMutex(mutexPtr);
+#endif
+ ForgetSyncObject(mutexPtr, &mutexRecord);
+ TclpMasterUnlock();
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
* TclRememberCondition
*
* Keep a list of condition variables used during finalization.