summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoe Mistachkin <joe@mistachkin.com>2013-10-28 21:01:47 (GMT)
committerJoe Mistachkin <joe@mistachkin.com>2013-10-28 21:01:47 (GMT)
commit5399cdf3b1ddf72ac37efa3b23117cd69836552a (patch)
treecd5e491495f6474338112c334725164d8bf900b8
parent31743e869875ae77eabfb6f822fc014b0822ccf9 (diff)
downloadtcl-5399cdf3b1ddf72ac37efa3b23117cd69836552a.zip
tcl-5399cdf3b1ddf72ac37efa3b23117cd69836552a.tar.gz
tcl-5399cdf3b1ddf72ac37efa3b23117cd69836552a.tar.bz2
Attempt to make sure the notifier gets fully re-initialized.
-rw-r--r--unix/tclUnixNotfy.c31
1 files changed, 24 insertions, 7 deletions
diff --git a/unix/tclUnixNotfy.c b/unix/tclUnixNotfy.c
index 505d205..4ce4840 100644
--- a/unix/tclUnixNotfy.c
+++ b/unix/tclUnixNotfy.c
@@ -1344,21 +1344,38 @@ AtForkChildProc(void)
/*
* Reset the notifier reference count to zero (i.e. not initialized).
* This should force the notifier initialization code to be re-run the
- * very next time Tcl_InitNotifier is called.
- *
- * For a plain [exec ...] this will not happen, and everything is fine.
- * For a full fork of the interpreter (like apache Rivet) it is not clear
- * to me (AK) where TIN would be called.
+ * very next time Tcl_InitNotifier is called, which will be at the end
+ * of this function.
*/
notifierCount = 0;
/*
- * Finally, release the notifier mutex (which has been held since the
- * AtForkPrepareProc() was called via pthread_atfork()).
+ * Finalize and reset the condition variable. This should force it to
+ * be re-created during the next call to Tcl_ConditionWait().
+ */
+
+ Tcl_ConditionFinalize(&notifierCV);
+ notifierCV = NULL;
+
+ /*
+ * Release, finalize, and reset the notifier mutex (which has been
+ * held since the AtForkPrepareProc() was called via pthread_atfork()).
+ * This should force it to be re-created during the next call to
+ * Tcl_MutexLock().
*/
Tcl_MutexUnlock(&notifierMutex);
+ Tcl_MutexFinalize(&notifierMutex);
+ notifierMutex = NULL;
+
+ /*
+ * Force the notifier subsystem to be initialized now. This should
+ * create the notifier thread in this process. Subsequently, that new
+ * thread will re-open the trigger pipe.
+ */
+
+ Tcl_InitNotifier();
}
#endif /* HAVE_PTHREAD_ATFORK */