From 967856b8f844223b509f90a973121517e7c45c34 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 e8d057ad672b4675495c308059b951afaa3ce020 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 d249a8af5d7eaaed1b6e7251a696ce0c68f3a86c 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