diff options
author | davygrvy <davygrvy@noemail.net> | 2004-05-06 01:02:57 (GMT) |
---|---|---|
committer | davygrvy <davygrvy@noemail.net> | 2004-05-06 01:02:57 (GMT) |
commit | 108d5a89cc8c0fb1d07b885b25b572666d06c816 (patch) | |
tree | 8be2eee4339ed42785159834b5069e9f59dc7f0f /win | |
parent | 0107898f9007c5dfc8a52b4f026960767c963aa8 (diff) | |
download | tcl-108d5a89cc8c0fb1d07b885b25b572666d06c816.zip tcl-108d5a89cc8c0fb1d07b885b25b572666d06c816.tar.gz tcl-108d5a89cc8c0fb1d07b885b25b572666d06c816.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.
FossilOrigin-Name: f350fff0077e89cd6755b6a6300733df36be6f49
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 e09d327..558cee4 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.24.2.4 2004/04/23 07:17:39 davygrvy Exp $ + * RCS: @(#) $Id: tclWinThrd.c,v 1.24.2.5 2004/05/06 01:03:14 davygrvy Exp $ */ #include "tclWinInt.h" @@ -44,6 +44,7 @@ static CRITICAL_SECTION initLock; static CRITICAL_SECTION allocLock; static Tcl_Mutex allocLockPtr = (Tcl_Mutex) &allocLock; +static int allocOnce = 0; #endif /* TCL_THREADS */ @@ -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); + allocOnce = 0; +#endif + /* Destroy the critical section that we are holding. */ + DeleteCriticalSection(&initLock); +} #ifdef TCL_THREADS |