diff options
author | davygrvy <davygrvy@pobox.com> | 2004-04-23 07:20:09 (GMT) |
---|---|---|
committer | davygrvy <davygrvy@pobox.com> | 2004-04-23 07:20:09 (GMT) |
commit | b9fbb790fc3e89f64c1034b6ee5af4210c11d12a (patch) | |
tree | 88e958c61aa8200f45ed61a91030511bb71521d5 /win | |
parent | f613f9eed33b82c3d712a4679fa56e3192d9e283 (diff) | |
download | tcl-b9fbb790fc3e89f64c1034b6ee5af4210c11d12a.zip tcl-b9fbb790fc3e89f64c1034b6ee5af4210c11d12a.tar.gz tcl-b9fbb790fc3e89f64c1034b6ee5af4210c11d12a.tar.bz2 |
* generic/tclInt.h:
* generic/tclThread.c:
* generic/tclEvent.c:
* unix/tclUnixThrd.c:
* win/tclWinThrd.c: Provisions made so masterLock, initLock,
allocLock and joinLock mutexes can be recovered during
Tcl_Finalize.
Diffstat (limited to 'win')
-rw-r--r-- | win/tclWinThrd.c | 41 |
1 files changed, 36 insertions, 5 deletions
diff --git a/win/tclWinThrd.c b/win/tclWinThrd.c index fd6ad65..80ef5ed 100644 --- a/win/tclWinThrd.c +++ b/win/tclWinThrd.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinThrd.c,v 1.28 2004/01/11 20:36:48 davygrvy Exp $ + * RCS: @(#) $Id: tclWinThrd.c,v 1.29 2004/04/23 07:21:41 davygrvy Exp $ */ #include "tclWinInt.h" @@ -25,6 +25,7 @@ static CRITICAL_SECTION masterLock; static int init = 0; +static int allocOnce = 0; #define MASTER_LOCK EnterCriticalSection(&masterLock) #define MASTER_UNLOCK LeaveCriticalSection(&masterLock) @@ -393,18 +394,48 @@ Tcl_Mutex * Tcl_GetAllocMutex() { #ifdef TCL_THREADS - static int once = 0; - - if (!once) { + if (!allocOnce) { InitializeCriticalSection(&allocLock); - once = 1; + allocOnce = 1; } return &allocLockPtr; #else return NULL; #endif } + +/* + *---------------------------------------------------------------------- + * + * TclpFinalizeLock + * + * This procedure is used to destroy all private resources used in + * this file. + * + * Results: + * None. + * + * Side effects: + * Destroys everything private. TclpInitLock must be held + * entering this function. + * + *---------------------------------------------------------------------- + */ +void +TclFinalizeLock () +{ + MASTER_LOCK; + DeleteCriticalSection(&joinLock); + DeleteCriticalSection(&masterLock); + init = 0; +#ifdef TCL_THREADS + DeleteCriticalSection(&allocLock); +#endif + allocOnce = 0; + /* Destroy the critical section that we are holding. */ + DeleteCriticalSection(&initLock); +} #ifdef TCL_THREADS |