summaryrefslogtreecommitdiffstats
path: root/unix/tclUnixThrd.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2016-03-21 11:59:19 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2016-03-21 11:59:19 (GMT)
commita2827884a964758c13230c45ba18fa131cabbb8d (patch)
tree0cda46a44d9942cfd39d10fb3008909c5b78847f /unix/tclUnixThrd.c
parent6f7c0d0cb81c0a6d9144679065e189a6274ac1ed (diff)
parentfdcc17288c87da3542dba646f601b61b05b7d611 (diff)
downloadtcl-a2827884a964758c13230c45ba18fa131cabbb8d.zip
tcl-a2827884a964758c13230c45ba18fa131cabbb8d.tar.gz
tcl-a2827884a964758c13230c45ba18fa131cabbb8d.tar.bz2
Fix [d3071887dbc7aeac]: Fix SEGV in Tcl_FinalizeNotifier(). Thanks to hirofumi for both the bug-report and the fix.
Use TclpMasterLock() in stead of MASTER_LOCK everywhere (in stead of in some files only, not in others). Use "static int initialized" variable consistantly. Fix some comments. No change of functionality.
Diffstat (limited to 'unix/tclUnixThrd.c')
-rw-r--r--unix/tclUnixThrd.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/unix/tclUnixThrd.c b/unix/tclUnixThrd.c
index ea03332..554a2dc 100644
--- a/unix/tclUnixThrd.c
+++ b/unix/tclUnixThrd.c
@@ -44,13 +44,6 @@ static pthread_mutex_t initLock = PTHREAD_MUTEX_INITIALIZER;
static pthread_mutex_t allocLock = PTHREAD_MUTEX_INITIALIZER;
static pthread_mutex_t *allocLockPtr = &allocLock;
-/*
- * These are for the critical sections inside this file.
- */
-
-#define MASTER_LOCK pthread_mutex_lock(&masterLock)
-#define MASTER_UNLOCK pthread_mutex_unlock(&masterLock)
-
#endif /* TCL_THREADS */
/*
@@ -252,7 +245,7 @@ TclpInitLock(void)
/*
*----------------------------------------------------------------------
*
- * TclpFinalizeLock
+ * TclFinalizeLock
*
* This procedure is used to destroy all private resources used in this
* file.
@@ -421,7 +414,7 @@ Tcl_MutexLock(
pthread_mutex_t *pmutexPtr;
if (*mutexPtr == NULL) {
- MASTER_LOCK;
+ pthread_mutex_lock(&masterLock);
if (*mutexPtr == NULL) {
/*
* Double inside master lock check to avoid a race condition.
@@ -432,7 +425,7 @@ Tcl_MutexLock(
*mutexPtr = (Tcl_Mutex)pmutexPtr;
TclRememberMutex(mutexPtr);
}
- MASTER_UNLOCK;
+ pthread_mutex_unlock(&masterLock);
}
pmutexPtr = *((pthread_mutex_t **)mutexPtr);
pthread_mutex_lock(pmutexPtr);
@@ -529,7 +522,7 @@ Tcl_ConditionWait(
struct timespec ptime;
if (*condPtr == NULL) {
- MASTER_LOCK;
+ pthread_mutex_lock(&masterLock);
/*
* Double check inside mutex to avoid race, then initialize condition
@@ -542,7 +535,7 @@ Tcl_ConditionWait(
*condPtr = (Tcl_Condition) pcondPtr;
TclRememberCondition(condPtr);
}
- MASTER_UNLOCK;
+ pthread_mutex_unlock(&masterLock);
}
pmutexPtr = *((pthread_mutex_t **)mutexPtr);
pcondPtr = *((pthread_cond_t **)condPtr);