From 7f97c937b35654a9f152c4f9a9f73f697a073efe Mon Sep 17 00:00:00 2001 From: davygrvy Date: Tue, 27 Apr 2004 17:17:37 +0000 Subject: A little source clean-up with the allocOnce variable. --- win/tclWinThrd.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/win/tclWinThrd.c b/win/tclWinThrd.c index 80ef5ed..88e2cda 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.29 2004/04/23 07:21:41 davygrvy Exp $ + * RCS: @(#) $Id: tclWinThrd.c,v 1.30 2004/04/27 17:17:37 davygrvy Exp $ */ #include "tclWinInt.h" @@ -25,7 +25,6 @@ static CRITICAL_SECTION masterLock; static int init = 0; -static int allocOnce = 0; #define MASTER_LOCK EnterCriticalSection(&masterLock) #define MASTER_UNLOCK LeaveCriticalSection(&masterLock) @@ -45,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 */ @@ -430,9 +430,11 @@ TclFinalizeLock () DeleteCriticalSection(&masterLock); init = 0; #ifdef TCL_THREADS - DeleteCriticalSection(&allocLock); + if (allocOnce) { + DeleteCriticalSection(&allocLock); + allocOnce = 0; + } #endif - allocOnce = 0; /* Destroy the critical section that we are holding. */ DeleteCriticalSection(&initLock); } -- cgit v0.12