From 067dafca0bf3ee80f5e1c9b998d40e6ea468cfa3 Mon Sep 17 00:00:00 2001 From: Joe Mistachkin Date: Thu, 21 May 2015 17:58:49 +0000 Subject: Additional mutex locking/unlocking during fork() to keep things synchronized. --- unix/tclUnixNotfy.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/unix/tclUnixNotfy.c b/unix/tclUnixNotfy.c index aa32915..9186f33 100644 --- a/unix/tclUnixNotfy.c +++ b/unix/tclUnixNotfy.c @@ -1334,6 +1334,7 @@ NotifierThreadProc( static void AtForkPrepare(void) { + Tcl_MutexLock(¬ifierMutex); } /* @@ -1355,6 +1356,7 @@ AtForkPrepare(void) static void AtForkParent(void) { + Tcl_MutexUnlock(¬ifierMutex); } /* -- cgit v0.12 From 1b423f2d3a9c5f583ea4cf826489aa9f07c2a1ca Mon Sep 17 00:00:00 2001 From: Joe Mistachkin Date: Wed, 27 May 2015 22:29:25 +0000 Subject: Make sure the master and mutex locks are in a well-known state across the fork() call. --- unix/tclUnixNotfy.c | 6 ++++++ 1 file changed, 6 insertions(+) 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(¬ifierMutex); + TclpMasterLock(); + TclpMutexLock(); } /* @@ -1356,6 +1358,8 @@ AtForkPrepare(void) static void AtForkParent(void) { + TclpMutexLock(); + TclpMasterLock(); Tcl_MutexUnlock(¬ifierMutex); } @@ -1378,6 +1382,8 @@ AtForkParent(void) static void AtForkChild(void) { + TclpMutexLock(); + TclpMasterLock(); Tcl_MutexUnlockAndFinalize(¬ifierMutex); Tcl_InitNotifier(); } -- cgit v0.12 From ed5453934369f6fb2b7b45f8ef1e9854e7268679 Mon Sep 17 00:00:00 2001 From: Joe Mistachkin Date: Wed, 27 May 2015 22:34:53 +0000 Subject: Fix typo in previous check-in. --- unix/tclUnixNotfy.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/unix/tclUnixNotfy.c b/unix/tclUnixNotfy.c index 2941331..219dd75 100644 --- a/unix/tclUnixNotfy.c +++ b/unix/tclUnixNotfy.c @@ -1358,8 +1358,8 @@ AtForkPrepare(void) static void AtForkParent(void) { - TclpMutexLock(); - TclpMasterLock(); + TclpMutexUnlock(); + TclpMasterUnlock(); Tcl_MutexUnlock(¬ifierMutex); } @@ -1382,8 +1382,8 @@ AtForkParent(void) static void AtForkChild(void) { - TclpMutexLock(); - TclpMasterLock(); + TclpMutexUnlock(); + TclpMasterUnlock(); Tcl_MutexUnlockAndFinalize(¬ifierMutex); Tcl_InitNotifier(); } -- cgit v0.12