diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2015-10-19 12:53:20 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2015-10-19 12:53:20 (GMT) |
commit | 699c7669d27cbd7e1a7fe515e89e2755a28e3406 (patch) | |
tree | 47af18de869f496be9c339747fa96c9cd469aa93 /unix/tclUnixThrd.c | |
parent | ecec02fb16d9d8b720987fb25ee1e517b085e699 (diff) | |
parent | 602a687e5116fe133efb686f83f92cb108429306 (diff) | |
download | tcl-699c7669d27cbd7e1a7fe515e89e2755a28e3406.zip tcl-699c7669d27cbd7e1a7fe515e89e2755a28e3406.tar.gz tcl-699c7669d27cbd7e1a7fe515e89e2755a28e3406.tar.bz2 |
merge trunk
Diffstat (limited to 'unix/tclUnixThrd.c')
-rw-r--r-- | unix/tclUnixThrd.c | 51 |
1 files changed, 2 insertions, 49 deletions
diff --git a/unix/tclUnixThrd.c b/unix/tclUnixThrd.c index 887689a..2440a98 100644 --- a/unix/tclUnixThrd.c +++ b/unix/tclUnixThrd.c @@ -16,19 +16,6 @@ #ifdef TCL_THREADS /* - * This is the number of milliseconds to wait between internal retries in - * the Tcl_MutexLock function. This value must be greater than zero and - * should be a suitable value for the given platform. - * - * TODO: This may need to be dynamically determined, based on the relative - * performance of the running process. - */ - -#ifndef TCL_MUTEX_LOCK_SLEEP_TIME -# define TCL_MUTEX_LOCK_SLEEP_TIME (25) -#endif - -/* * masterLock is used to serialize creation of mutexes, condition variables, * and thread local storage. This is the only place that can count on the * ability to statically initialize the mutex. @@ -52,13 +39,6 @@ static pthread_mutex_t allocLock = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t *allocLockPtr = &allocLock; /* - * The mutexLock serializes Tcl_MutexLock. This is necessary to prevent - * races when finalizing a mutex that some other thread may want to lock. - */ - -static pthread_mutex_t mutexLock = PTHREAD_MUTEX_INITIALIZER; - -/* * These are for the critical sections inside this file. */ @@ -374,7 +354,6 @@ TclpMasterUnlock(void) pthread_mutex_unlock(&masterLock); #endif } - /* *---------------------------------------------------------------------- @@ -435,8 +414,6 @@ Tcl_MutexLock( { pthread_mutex_t *pmutexPtr; -retry: - if (*mutexPtr == NULL) { MASTER_LOCK; if (*mutexPtr == NULL) { @@ -451,32 +428,8 @@ retry: } MASTER_UNLOCK; } - while (1) { - pthread_mutex_lock(&mutexLock); - pmutexPtr = *((pthread_mutex_t **)mutexPtr); - if (pmutexPtr == NULL) { - pthread_mutex_unlock(&mutexLock); - goto retry; - } - if (pthread_mutex_trylock(pmutexPtr) == 0) { - pthread_mutex_unlock(&mutexLock); - return; - } - pthread_mutex_unlock(&mutexLock); - /* - * BUGBUG: All core and Thread package tests pass when usleep() - * is used; however, the Thread package tests hang at - * various places when Tcl_Sleep() is used, typically - * while running test "thread-17.8", "thread-17.9", or - * "thread-17.11a". Really, what we want here is just - * to yield to other threads for a while. - */ -#ifdef HAVE_USLEEP - usleep(TCL_MUTEX_LOCK_SLEEP_TIME * 1000); -#else - Tcl_Sleep(TCL_MUTEX_LOCK_SLEEP_TIME); -#endif - } + pmutexPtr = *((pthread_mutex_t **)mutexPtr); + pthread_mutex_lock(pmutexPtr); } /* |