summaryrefslogtreecommitdiffstats
path: root/win/tclWinThrd.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2015-10-17 07:21:19 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2015-10-17 07:21:19 (GMT)
commitb26b272f52e27f26233144697e4526a6f156e4c0 (patch)
tree88987abaa7de45d75d5885ac60b37b3fbf448acd /win/tclWinThrd.c
parent3163979b3cb394f9d2107c244d0bfc1a7dbc012c (diff)
downloadtcl-b26b272f52e27f26233144697e4526a6f156e4c0.zip
tcl-b26b272f52e27f26233144697e4526a6f156e4c0.tar.gz
tcl-b26b272f52e27f26233144697e4526a6f156e4c0.tar.bz2
Proposed fix for [ba44e415a0]: "Use of mutexLock causes problem with reactive event handling in AndroWish".bug_ba44e415a0
This basically undoes the retry mechamism in Tcl_MutexLock, introduced in [9f8b7bea53]. Does this retry mechamism hurt more than it helps? Feedback requested.
Diffstat (limited to 'win/tclWinThrd.c')
-rw-r--r--win/tclWinThrd.c37
1 files changed, 5 insertions, 32 deletions
diff --git a/win/tclWinThrd.c b/win/tclWinThrd.c
index ae7ce80..927e115 100644
--- a/win/tclWinThrd.c
+++ b/win/tclWinThrd.c
@@ -24,16 +24,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.
*/
@@ -67,13 +57,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
@@ -386,7 +369,6 @@ TclpInitLock(void)
*/
init = 1;
- InitializeCriticalSection(&mutexLock);
InitializeCriticalSection(&joinLock);
InitializeCriticalSection(&initLock);
InitializeCriticalSection(&masterLock);
@@ -534,7 +516,6 @@ void
TclFinalizeLock(void)
{
MASTER_LOCK;
- DeleteCriticalSection(&mutexLock);
DeleteCriticalSection(&joinLock);
/*
@@ -605,20 +586,12 @@ 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);
+ if (csPtr == NULL) {
+ goto retry;
}
+ EnterCriticalSection(csPtr);
}
/*