diff options
| author | zv@archiware.com <vasiljevic> | 2005-04-07 11:28:22 (GMT) |
|---|---|---|
| committer | zv@archiware.com <vasiljevic> | 2005-04-07 11:28:22 (GMT) |
| commit | a575a8ab0c98b6f1558309896715c46f8c3c19e9 (patch) | |
| tree | 497225b994ecdca3af2d1f21a8c90005fef8e090 /unix/tclUnixThrd.c | |
| parent | 8b2474d2281bc987b3056e1712eb10b564f23a51 (diff) | |
| download | tcl-a575a8ab0c98b6f1558309896715c46f8c3c19e9.zip tcl-a575a8ab0c98b6f1558309896715c46f8c3c19e9.tar.gz tcl-a575a8ab0c98b6f1558309896715c46f8c3c19e9.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.c | 17 |
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; } |
