summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2015-10-18 10:31:50 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2015-10-18 10:31:50 (GMT)
commitb22ebcce6b9f2e861a4c9fed13421df0c76769d6 (patch)
tree53657a059595a7b1b134a293653ae26e599e93c3 /win
parentde3fd77202d2f00e549b962c6b56a85f5d8d7042 (diff)
parentb26b272f52e27f26233144697e4526a6f156e4c0 (diff)
downloadtcl-b22ebcce6b9f2e861a4c9fed13421df0c76769d6.zip
tcl-b22ebcce6b9f2e861a4c9fed13421df0c76769d6.tar.gz
tcl-b22ebcce6b9f2e861a4c9fed13421df0c76769d6.tar.bz2
Bring back Tcl_MutexLock() to exact implementation in Tcl 8.5.18. For details, see [ba44e415a0]: Use of mutexLock causes problem with reactive event handling in AndroWish
Diffstat (limited to 'win')
-rw-r--r--win/tclWinThrd.c37
1 files changed, 2 insertions, 35 deletions
diff --git a/win/tclWinThrd.c b/win/tclWinThrd.c
index dc9f082..2413a78 100644
--- a/win/tclWinThrd.c
+++ b/win/tclWinThrd.c
@@ -23,16 +23,6 @@ _CRTIMP unsigned int __cdecl _controlfp (unsigned int unNew, unsigned int unMask
#endif
/*
- * This is the number of milliseconds to wait between internal retries in
- * the Tcl_MutexLock function. This value must be greater than or equal
- * to zero and should be a suitable value for the given platform.
- */
-
-#ifndef TCL_MUTEX_LOCK_SLEEP_TIME
-# define TCL_MUTEX_LOCK_SLEEP_TIME (0)
-#endif
-
-/*
* This is the master lock used to serialize access to other serialization
* data structures.
*/
@@ -66,13 +56,6 @@ static int allocOnce = 0;
#endif /* TCL_THREADS */
/*
- * The mutexLock serializes Tcl_MutexLock. This is necessary to prevent
- * races when finalizing a mutex that some other thread may want to lock.
- */
-
-static CRITICAL_SECTION mutexLock;
-
-/*
* The joinLock serializes Create- and ExitThread. This is necessary to
* prevent a race where a new joinable thread exits before the creating thread
* had the time to create the necessary data structures in the emulation
@@ -385,7 +368,6 @@ TclpInitLock(void)
*/
init = 1;
- InitializeCriticalSection(&mutexLock);
InitializeCriticalSection(&joinLock);
InitializeCriticalSection(&initLock);
InitializeCriticalSection(&masterLock);
@@ -533,7 +515,6 @@ void
TclFinalizeLock(void)
{
MASTER_LOCK;
- DeleteCriticalSection(&mutexLock);
DeleteCriticalSection(&joinLock);
/*
@@ -587,8 +568,6 @@ Tcl_MutexLock(
{
CRITICAL_SECTION *csPtr;
-retry:
-
if (*mutexPtr == NULL) {
MASTER_LOCK;
@@ -604,20 +583,8 @@ retry:
}
MASTER_UNLOCK;
}
- while (1) {
- EnterCriticalSection(&mutexLock);
- csPtr = *((CRITICAL_SECTION **)mutexPtr);
- if (csPtr == NULL) {
- LeaveCriticalSection(&mutexLock);
- goto retry;
- }
- if (TryEnterCriticalSection(csPtr)) {
- LeaveCriticalSection(&mutexLock);
- return;
- }
- LeaveCriticalSection(&mutexLock);
- Tcl_Sleep(TCL_MUTEX_LOCK_SLEEP_TIME);
- }
+ csPtr = *((CRITICAL_SECTION **)mutexPtr);
+ EnterCriticalSection(csPtr);
}
/*