diff options
| author | zv@archiware.com <vasiljevic> | 2005-04-16 08:01:22 (GMT) |
|---|---|---|
| committer | zv@archiware.com <vasiljevic> | 2005-04-16 08:01:22 (GMT) |
| commit | d36095f943711901802f02e9a3d8432e7d7c2c52 (patch) | |
| tree | 0ba17e1cf89e8144a8f66d879c642446c45be3d2 /unix | |
| parent | 5dd40f76eded53460fbdc19c5fc602179546d781 (diff) | |
| download | tcl-d36095f943711901802f02e9a3d8432e7d7c2c52.zip tcl-d36095f943711901802f02e9a3d8432e7d7c2c52.tar.gz tcl-d36095f943711901802f02e9a3d8432e7d7c2c52.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')
| -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 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; } |
