summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2018-04-05 13:34:58 (GMT)
committerdgp <dgp@users.sourceforge.net>2018-04-05 13:34:58 (GMT)
commit0ad3b13e2663019e4ff8d3dc944fd030e33eb358 (patch)
tree68757f4e4c6a16613a698a044f74a28382955c11
parenta5d6e9657a73455c2b0163d64a0fd0938962849b (diff)
downloadtcl-0ad3b13e2663019e4ff8d3dc944fd030e33eb358.zip
tcl-0ad3b13e2663019e4ff8d3dc944fd030e33eb358.tar.gz
tcl-0ad3b13e2663019e4ff8d3dc944fd030e33eb358.tar.bz2
Failed to mutex protect all multi-thread access to the hash tables in the
[tcl::process] implementation. This was causing segfaults in thread-8.1.
-rw-r--r--generic/tclProcess.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/generic/tclProcess.c b/generic/tclProcess.c
index 7187ee4..604b7ce 100644
--- a/generic/tclProcess.c
+++ b/generic/tclProcess.c
@@ -887,6 +887,7 @@ TclProcessWait(
* First search for pid in table.
*/
+ Tcl_MutexLock(&infoTablesMutex);
entry = Tcl_FindHashEntry(&infoTablePerPid, pid);
if (!entry) {
/*
@@ -897,6 +898,7 @@ TclProcessWait(
msgObjPtr, errorObjPtr);
if (msgObjPtr && *msgObjPtr) Tcl_IncrRefCount(*msgObjPtr);
if (errorObjPtr && *errorObjPtr) Tcl_IncrRefCount(*errorObjPtr);
+ Tcl_MutexUnlock(&infoTablesMutex);
return result;
}
@@ -906,6 +908,7 @@ TclProcessWait(
* Process has completed but TclProcessWait has already been called,
* so report no change.
*/
+ Tcl_MutexUnlock(&infoTablesMutex);
return TCL_PROCESS_UNCHANGED;
}
@@ -915,6 +918,7 @@ TclProcessWait(
/*
* No change, stop there.
*/
+ Tcl_MutexUnlock(&infoTablesMutex);
return TCL_PROCESS_UNCHANGED;
}
@@ -948,5 +952,6 @@ TclProcessWait(
info->purge = 1;
}
+ Tcl_MutexUnlock(&infoTablesMutex);
return result;
}