summaryrefslogtreecommitdiffstats
path: root/win/tclWinThrd.c
diff options
context:
space:
mode:
authordavygrvy <davygrvy@pobox.com>2004-04-23 07:11:26 (GMT)
committerdavygrvy <davygrvy@pobox.com>2004-04-23 07:11:26 (GMT)
commit5b91da692e931bb424e837c60a0841b1d38b5dac (patch)
treee17ec1ad16e823b582ad5973ba659e42538c6ed6 /win/tclWinThrd.c
parent2446d3e4c19bc8727f648e7fe66136a97247fcc5 (diff)
downloadtcl-5b91da692e931bb424e837c60a0841b1d38b5dac.zip
tcl-5b91da692e931bb424e837c60a0841b1d38b5dac.tar.gz
tcl-5b91da692e931bb424e837c60a0841b1d38b5dac.tar.bz2
* win/tclWinTime.c: If the Tcl_ExitProc (StopCalibration) is
called from the stack frame of DllMain's PROCESS_DETACH, the wait operation should timeout and continue.
Diffstat (limited to 'win/tclWinThrd.c')
-rw-r--r--win/tclWinThrd.c39
1 files changed, 34 insertions, 5 deletions
diff --git a/win/tclWinThrd.c b/win/tclWinThrd.c
index 208f066..8d738b3 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.2 2003/05/13 09:57:40 mistachkin Exp $
+ * RCS: @(#) $Id: tclWinThrd.c,v 1.24.2.3 2004/04/23 07:11:26 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,46 @@ 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;
+ DeleteCriticalSection(&allocLock);
+ allocOnce = 0;
+ /* Destroy the critical section that we are holding. */
+ DeleteCriticalSection(&initLock);
+}
#ifdef TCL_THREADS