summaryrefslogtreecommitdiffstats
path: root/unix
diff options
context:
space:
mode:
authorJoe Mistachkin <joe@mistachkin.com>2015-05-28 00:53:33 (GMT)
committerJoe Mistachkin <joe@mistachkin.com>2015-05-28 00:53:33 (GMT)
commit24fdf2893b2456dba53e49f20fc54769fa6cbc0c (patch)
tree71ca1aaad8738c90d56250145b42c5c2f1ee906c /unix
parent7fa687177b07fd7f6b98ae321402848466ce6d17 (diff)
parented5453934369f6fb2b7b45f8ef1e9854e7268679 (diff)
downloadtcl-24fdf2893b2456dba53e49f20fc54769fa6cbc0c.zip
tcl-24fdf2893b2456dba53e49f20fc54769fa6cbc0c.tar.gz
tcl-24fdf2893b2456dba53e49f20fc54769fa6cbc0c.tar.bz2
Make sure the necessary mutexes are in a well-known state across calls to fork().
Diffstat (limited to 'unix')
-rw-r--r--unix/tclUnixNotfy.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/unix/tclUnixNotfy.c b/unix/tclUnixNotfy.c
index aa32915..219dd75 100644
--- a/unix/tclUnixNotfy.c
+++ b/unix/tclUnixNotfy.c
@@ -1334,6 +1334,9 @@ NotifierThreadProc(
static void
AtForkPrepare(void)
{
+ Tcl_MutexLock(&notifierMutex);
+ TclpMasterLock();
+ TclpMutexLock();
}
/*
@@ -1355,6 +1358,9 @@ AtForkPrepare(void)
static void
AtForkParent(void)
{
+ TclpMutexUnlock();
+ TclpMasterUnlock();
+ Tcl_MutexUnlock(&notifierMutex);
}
/*
@@ -1376,6 +1382,8 @@ AtForkParent(void)
static void
AtForkChild(void)
{
+ TclpMutexUnlock();
+ TclpMasterUnlock();
Tcl_MutexUnlockAndFinalize(&notifierMutex);
Tcl_InitNotifier();
}