summaryrefslogtreecommitdiffstats
path: root/unix/tclUnixThrd.c
diff options
context:
space:
mode:
authorvasiljevic <zv@archiware.com>2005-04-16 08:01:22 (GMT)
committervasiljevic <zv@archiware.com>2005-04-16 08:01:22 (GMT)
commitb7591f6cc04595e00467f5fdbb6db5e95cf2ea65 (patch)
tree0ba17e1cf89e8144a8f66d879c642446c45be3d2 /unix/tclUnixThrd.c
parent49ef966c3dfe153816d01fe5022971cbbc10c82e (diff)
downloadtcl-b7591f6cc04595e00467f5fdbb6db5e95cf2ea65.zip
tcl-b7591f6cc04595e00467f5fdbb6db5e95cf2ea65.tar.gz
tcl-b7591f6cc04595e00467f5fdbb6db5e95cf2ea65.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.
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 f163782..19e73c5 100644
--- a/unix/tclUnixThrd.c
+++ b/unix/tclUnixThrd.c
@@ -933,13 +933,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;
}