diff options
author | hobbs <hobbs@noemail.net> | 2004-07-21 01:45:43 (GMT) |
---|---|---|
committer | hobbs <hobbs@noemail.net> | 2004-07-21 01:45:43 (GMT) |
commit | 57121112b05934476120710663e04c7f46c3f602 (patch) | |
tree | a73f70550f592464825b855b97bcf3574735f983 /generic/tclThreadAlloc.c | |
parent | 7ee0fa69587843c66df5070c7e2a25c5d58aad5b (diff) | |
download | tcl-57121112b05934476120710663e04c7f46c3f602.zip tcl-57121112b05934476120710663e04c7f46c3f602.tar.gz tcl-57121112b05934476120710663e04c7f46c3f602.tar.bz2 |
* generic/tclEvent.c: Correct threaded obj allocator to
* generic/tclInt.h: fully cleanup on exit and allow for
* generic/tclThreadAlloc.c: reinitialization. [Bug #736426]
* unix/tclUnixThrd.c: (mistachkin, kenny)
* win/tclWinThrd.c:
FossilOrigin-Name: 8a65a2464880b4541e914f40481de38341ba56df
Diffstat (limited to 'generic/tclThreadAlloc.c')
-rwxr-xr-x | generic/tclThreadAlloc.c | 62 |
1 files changed, 60 insertions, 2 deletions
diff --git a/generic/tclThreadAlloc.c b/generic/tclThreadAlloc.c index 8f2b336..553bd4f 100755 --- a/generic/tclThreadAlloc.c +++ b/generic/tclThreadAlloc.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclThreadAlloc.c,v 1.13 2004/06/21 08:54:34 dkf Exp $ + * RCS: @(#) $Id: tclThreadAlloc.c,v 1.14 2004/07/21 01:45:44 hobbs Exp $ */ #include "tclInt.h" @@ -631,7 +631,7 @@ Tcl_GetMemoryInfo(dsPtr) if (cachePtr == sharedPtr) { Tcl_DStringAppendElement(dsPtr, "shared"); } else { - sprintf(buf, "thread%d", (int) cachePtr->owner); + sprintf(buf, "thread%p", cachePtr->owner); Tcl_DStringAppendElement(dsPtr, buf); } for (n = 0; n < NBUCKETS; ++n) { @@ -957,4 +957,62 @@ GetBlocks(cachePtr, bucket) return 1; } +/* + *---------------------------------------------------------------------- + * + * TclFinalizeThreadAlloc -- + * + * This procedure is used to destroy all private resources used in + * this file. + * + * Results: + * None. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +void +TclFinalizeThreadAlloc() +{ + int i; + for (i = 0; i < NBUCKETS; ++i) { + TclpFreeAllocMutex(bucketInfo[i].lockPtr); + bucketInfo[i].lockPtr = NULL; + } + + TclpFreeAllocMutex(objLockPtr); + objLockPtr = NULL; + + TclpFreeAllocMutex(listLockPtr); + listLockPtr = NULL; +} + +#else + +/* + *---------------------------------------------------------------------- + * + * TclFinalizeThreadAlloc -- + * + * This procedure is used to destroy all private resources used in + * this file. + * + * Results: + * None. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +void +TclFinalizeThreadAlloc() +{ + Tcl_Panic("TclFinalizeThreadAlloc called when threaded memory allocator not in use."); +} + #endif /* TCL_THREADS */ |