diff options
author | hobbs <hobbs> | 2004-07-21 01:30:56 (GMT) |
---|---|---|
committer | hobbs <hobbs> | 2004-07-21 01:30:56 (GMT) |
commit | 1421351399efa280f6108d55bc38c5bc90051dcc (patch) | |
tree | 485b0b4f6b33aad1eb86cc5ec0ddf7c71966fd7c /generic | |
parent | 3d2e7995dd6ea56840a0c4a2c00466ae914251db (diff) | |
download | tcl-1421351399efa280f6108d55bc38c5bc90051dcc.zip tcl-1421351399efa280f6108d55bc38c5bc90051dcc.tar.gz tcl-1421351399efa280f6108d55bc38c5bc90051dcc.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:
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclEvent.c | 6 | ||||
-rw-r--r-- | generic/tclInt.h | 5 | ||||
-rwxr-xr-x | generic/tclThreadAlloc.c | 60 |
3 files changed, 67 insertions, 4 deletions
diff --git a/generic/tclEvent.c b/generic/tclEvent.c index 19bb0d6..67ec728 100644 --- a/generic/tclEvent.c +++ b/generic/tclEvent.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: tclEvent.c,v 1.28.2.7 2004/07/15 09:57:10 vasiljevic Exp $ + * RCS: @(#) $Id: tclEvent.c,v 1.28.2.8 2004/07/21 01:30:57 hobbs Exp $ */ #include "tclInt.h" @@ -897,7 +897,9 @@ Tcl_Finalize() /* * There shouldn't be any malloc'ed memory after this. */ - +#if defined(TCL_THREADS) && defined(USE_THREAD_ALLOC) && !defined(TCL_MEM_DEBUG) && !defined(PURIFY) + TclFinalizeThreadAlloc(); +#endif TclFinalizeMemorySubsystem(); inFinalize = 0; } diff --git a/generic/tclInt.h b/generic/tclInt.h index 95129b6..c3c0904 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclInt.h,v 1.118.2.6 2004/06/22 11:55:35 vasiljevic Exp $ + * RCS: @(#) $Id: tclInt.h,v 1.118.2.7 2004/07/21 01:30:57 hobbs Exp $ */ #ifndef _TCLINT @@ -2138,6 +2138,9 @@ EXTERN Tcl_Obj *TclPtrIncrVar _ANSI_ARGS_((Tcl_Interp *interp, Var *varPtr, EXTERN Tcl_Obj *TclThreadAllocObj _ANSI_ARGS_((void)); EXTERN void TclThreadFreeObj _ANSI_ARGS_((Tcl_Obj *)); +EXTERN void TclFinalizeThreadAlloc _ANSI_ARGS_((void)); +EXTERN void TclpFreeAllocMutex _ANSI_ARGS_((Tcl_Mutex* mutex)); + # define TclAllocObjStorage(objPtr) \ (objPtr) = TclThreadAllocObj() diff --git a/generic/tclThreadAlloc.c b/generic/tclThreadAlloc.c index 0023e35..1bd51e6 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.4.2.2 2003/05/10 04:57:40 mistachkin Exp $ + * RCS: @(#) $Id: tclThreadAlloc.c,v 1.4.2.3 2004/07/21 01:30:57 hobbs Exp $ */ #if defined(TCL_THREADS) && defined(USE_THREAD_ALLOC) @@ -949,4 +949,62 @@ GetBlocks(Cache *cachePtr, int 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(binfo[i].lockPtr); + binfo[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 */ |