From 1c7799332924b711817436fc8940be2eff501b5c Mon Sep 17 00:00:00 2001 From: vasiljevic Date: Mon, 26 Nov 2007 14:05:08 +0000 Subject: * generic/tclThread.c: Back-port locking changes from Tcl8.5 in Tcl_Mutex/ConditionFinlize. Now we properly master-lock the finalization of sync primitives. --- ChangeLog | 6 ++++++ generic/tclThread.c | 12 +++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index fbe8165..37dc948 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2007-11-26 Zoran Vasiljevic + + * generic/tclThread.c: Back-port locking changes from Tcl8.5 + in Tcl_Mutex/ConditionFinlize. Now we properly master-lock + the finalization of sync primitives. + 2007-11-15 Don Porter * generic/regc_nfa.c: Fixed infinite loop in the regexp compiler diff --git a/generic/tclThread.c b/generic/tclThread.c index 033d197..23e82a0 100644 --- a/generic/tclThread.c +++ b/generic/tclThread.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclThread.c,v 1.6.2.2 2007/06/30 09:58:43 vasiljevic Exp $ + * RCS: @(#) $Id: tclThread.c,v 1.6.2.3 2007/11/26 14:05:10 vasiljevic Exp $ */ #include "tclInt.h" @@ -187,6 +187,8 @@ TclThreadDataKeySet(keyPtr, data) * Keep a list of (mutexes/condition variable/data key) * used during finalization. * + * Assume master lock is held. + * * Results: * None. * @@ -245,6 +247,7 @@ RememberSyncObject(objPtr, recPtr) * ForgetSyncObject * * Remove a single object from the list. + * Assume master lock is held. * * Results: * None. @@ -276,6 +279,7 @@ ForgetSyncObject(objPtr, recPtr) * TclRememberMutex * * Keep a list of mutexes used during finalization. + * Assume master lock is held. * * Results: * None. @@ -317,7 +321,9 @@ Tcl_MutexFinalize(mutexPtr) #ifdef TCL_THREADS TclpFinalizeMutex(mutexPtr); #endif + TclpMasterLock(); ForgetSyncObject((char *)mutexPtr, &mutexRecord); + TclpMasterUnlock(); } /* @@ -326,6 +332,7 @@ Tcl_MutexFinalize(mutexPtr) * TclRememberDataKey * * Keep a list of thread data keys used during finalization. + * Assume master lock is held. * * Results: * None. @@ -349,6 +356,7 @@ TclRememberDataKey(keyPtr) * TclRememberCondition * * Keep a list of condition variables used during finalization. + * Assume master lock is held. * * Results: * None. @@ -390,7 +398,9 @@ Tcl_ConditionFinalize(condPtr) #ifdef TCL_THREADS TclpFinalizeCondition(condPtr); #endif + TclpMasterLock(); ForgetSyncObject((char *)condPtr, &condRecord); + TclpMasterUnlock(); } /* -- cgit v0.12