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)
commit7f5f2ddc7fc9fae1abccdd0d1616ebd2b797d20c (patch)
tree71ca1aaad8738c90d56250145b42c5c2f1ee906c /unix
parent0f54d7701d56197babd64a6103e151606793167c (diff)
parentd249a8af5d7eaaed1b6e7251a696ce0c68f3a86c (diff)
downloadtcl-7f5f2ddc7fc9fae1abccdd0d1616ebd2b797d20c.zip
tcl-7f5f2ddc7fc9fae1abccdd0d1616ebd2b797d20c.tar.gz
tcl-7f5f2ddc7fc9fae1abccdd0d1616ebd2b797d20c.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();
}