summaryrefslogtreecommitdiffstats
path: root/generic/tclBasic.c
diff options
context:
space:
mode:
authordgp <dgp@noemail.net>2005-07-26 17:05:28 (GMT)
committerdgp <dgp@noemail.net>2005-07-26 17:05:28 (GMT)
commit1b6481e2612775d3d8fda46fe953264533407a3c (patch)
tree20e01256fc5ac4392f657594605b438ce66e68d8 /generic/tclBasic.c
parent3a70eea118a03c49dc0e3f3e8cd8de6b3a47c301 (diff)
downloadtcl-1b6481e2612775d3d8fda46fe953264533407a3c.zip
tcl-1b6481e2612775d3d8fda46fe953264533407a3c.tar.gz
tcl-1b6481e2612775d3d8fda46fe953264533407a3c.tar.bz2
* generic/tclBasic.c (Tcl_CallWhenDeleted): Converted to use
per-thread counter, rather than a process global one that required mutex protection. [RFE 1077194] FossilOrigin-Name: 461ce25bd83da347a9792e0452e3eccc1e3acef9
Diffstat (limited to 'generic/tclBasic.c')
-rw-r--r--generic/tclBasic.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/generic/tclBasic.c b/generic/tclBasic.c
index f1423cf..00673d5 100644
--- a/generic/tclBasic.c
+++ b/generic/tclBasic.c
@@ -13,7 +13,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclBasic.c,v 1.75.2.16 2005/06/21 17:19:40 dgp Exp $
+ * RCS: @(#) $Id: tclBasic.c,v 1.75.2.17 2005/07/26 17:05:43 dgp Exp $
*/
#include "tclInt.h"
@@ -648,19 +648,16 @@ Tcl_CallWhenDeleted(interp, proc, clientData)
ClientData clientData; /* One-word value to pass to proc. */
{
Interp *iPtr = (Interp *) interp;
- static int assocDataCounter = 0;
-#ifdef TCL_THREADS
- static Tcl_Mutex assocMutex;
-#endif
+ static Tcl_ThreadDataKey assocDataCounterKey;
+ int *assocDataCounterPtr =
+ Tcl_GetThreadData(&assocDataCounterKey, (int)sizeof(int));
int new;
char buffer[32 + TCL_INTEGER_SPACE];
AssocData *dPtr = (AssocData *) ckalloc(sizeof(AssocData));
Tcl_HashEntry *hPtr;
- Tcl_MutexLock(&assocMutex);
- sprintf(buffer, "Assoc Data Key #%d", assocDataCounter);
- assocDataCounter++;
- Tcl_MutexUnlock(&assocMutex);
+ sprintf(buffer, "Assoc Data Key #%d", *assocDataCounterPtr);
+ (*assocDataCounterPtr)++;
if (iPtr->assocData == (Tcl_HashTable *) NULL) {
iPtr->assocData = (Tcl_HashTable *) ckalloc(sizeof(Tcl_HashTable));