summaryrefslogtreecommitdiffstats
path: root/unix
diff options
context:
space:
mode:
authorJoe Mistachkin <joe@mistachkin.com>2015-05-27 22:29:25 (GMT)
committerJoe Mistachkin <joe@mistachkin.com>2015-05-27 22:29:25 (GMT)
commit1b423f2d3a9c5f583ea4cf826489aa9f07c2a1ca (patch)
treee6868c17d98c08a9daa36d1b9a367d9c5de3582c /unix
parent067dafca0bf3ee80f5e1c9b998d40e6ea468cfa3 (diff)
downloadtcl-1b423f2d3a9c5f583ea4cf826489aa9f07c2a1ca.zip
tcl-1b423f2d3a9c5f583ea4cf826489aa9f07c2a1ca.tar.gz
tcl-1b423f2d3a9c5f583ea4cf826489aa9f07c2a1ca.tar.bz2
Make sure the master and mutex locks are in a well-known state across the fork() call.
Diffstat (limited to 'unix')
-rw-r--r--unix/tclUnixNotfy.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/unix/tclUnixNotfy.c b/unix/tclUnixNotfy.c
index 9186f33..2941331 100644
--- a/unix/tclUnixNotfy.c
+++ b/unix/tclUnixNotfy.c
@@ -1335,6 +1335,8 @@ static void
AtForkPrepare(void)
{
Tcl_MutexLock(&notifierMutex);
+ TclpMasterLock();
+ TclpMutexLock();
}
/*
@@ -1356,6 +1358,8 @@ AtForkPrepare(void)
static void
AtForkParent(void)
{
+ TclpMutexLock();
+ TclpMasterLock();
Tcl_MutexUnlock(&notifierMutex);
}
@@ -1378,6 +1382,8 @@ AtForkParent(void)
static void
AtForkChild(void)
{
+ TclpMutexLock();
+ TclpMasterLock();
Tcl_MutexUnlockAndFinalize(&notifierMutex);
Tcl_InitNotifier();
}