summaryrefslogtreecommitdiffstats
path: root/unix/tclUnixThrd.c
diff options
context:
space:
mode:
authorvasiljevic <zv@archiware.com>2005-04-07 11:28:22 (GMT)
committervasiljevic <zv@archiware.com>2005-04-07 11:28:22 (GMT)
commitb1b25f985a53897c4403e2236c236453ecf5e4b4 (patch)
tree497225b994ecdca3af2d1f21a8c90005fef8e090 /unix/tclUnixThrd.c
parentc9b947d0bbffda30051c5afb7e1223f129e9d090 (diff)
downloadtcl-b1b25f985a53897c4403e2236c236453ecf5e4b4.zip
tcl-b1b25f985a53897c4403e2236c236453ecf5e4b4.tar.gz
tcl-b1b25f985a53897c4403e2236c236453ecf5e4b4.tar.bz2
Fixed TclpFreeAllocCache() to recognize when being called
with NULL argument. This is a signal for it to clean up the tsd key associated with the threading allocator. Part of fixing the Tcl Bug #1178445.
Diffstat (limited to 'unix/tclUnixThrd.c')
-rw-r--r--unix/tclUnixThrd.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/unix/tclUnixThrd.c b/unix/tclUnixThrd.c
index ee080ba..bdac40d 100644
--- a/unix/tclUnixThrd.c
+++ b/unix/tclUnixThrd.c
@@ -927,13 +927,16 @@ TclpFreeAllocMutex(mutex)
void TclpFreeAllocCache(ptr)
void *ptr;
{
- extern void TclFreeAllocCache(void *);
-
- TclFreeAllocCache(ptr);
- /*
- * Perform proper cleanup of things done in TclpGetAllocCache.
- */
- if (initialized) {
+ if (ptr != NULL) {
+ /*
+ * Called by the pthread lib when a thread exits
+ */
+ TclFreeAllocCache(ptr);
+ } else if (initialized) {
+ /*
+ * Called by us in TclFinalizeThreadAlloc() during
+ * the library finalization initiated from Tcl_Finalize()
+ */
pthread_key_delete(key);
initialized = 0;
}