From 1ce57bb924b57df1f03460ba98eaebc476ca6931 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 6 Aug 2015 03:43:43 +0000 Subject: Gustaf Neumann's experimental Unix notifier improvements. --- unix/tclUnixNotfy.c | 124 ++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 120 insertions(+), 4 deletions(-) diff --git a/unix/tclUnixNotfy.c b/unix/tclUnixNotfy.c index 17fdc95..a09899f 100644 --- a/unix/tclUnixNotfy.c +++ b/unix/tclUnixNotfy.c @@ -1,3 +1,6 @@ +#define LAZY_THREAD_CREATE 1 +#define AT_FORK_INIT_VALUE 0 +#define DEACTIVATE_ATFORK_MUTEX 0 /* * tclUnixNotify.c -- * @@ -160,6 +163,18 @@ static int triggerPipe = -1; TCL_DECLARE_MUTEX(notifierMutex) +#if LAZY_THREAD_CREATE == 1 +TCL_DECLARE_MUTEX(notifierInitMutex) + +/* + * The following static indicates if the notifier thread is running. + * + * You must hold the notifierInitLock before accessing this variable. + */ + +static int notifierThreadRunning = 0; +#endif + /* * The notifier thread signals the notifierCV when it has finished * initializing the triggerPipe and right before the notifier thread @@ -195,7 +210,7 @@ static Tcl_ThreadId notifierThread; #ifdef TCL_THREADS static void NotifierThreadProc(ClientData clientData); #if defined(HAVE_PTHREAD_ATFORK) && !defined(__APPLE__) && !defined(__hpux) -static int atForkInit = 0; +static int atForkInit = AT_FORK_INIT_VALUE; static void AtForkPrepare(void); static void AtForkParent(void); static void AtForkChild(void); @@ -257,6 +272,33 @@ extern unsigned char __stdcall TranslateMessage(const MSG *); static DWORD __stdcall NotifierProc(void *hwnd, unsigned int message, void *wParam, void *lParam); #endif /* TCL_THREADS && __CYGWIN__ */ + +#if LAZY_THREAD_CREATE == 1 +static void +StartNotifierThread(void) +{ + fprintf(stderr, "=== StartNotifierThread()\n"); + Tcl_MutexLock(¬ifierInitMutex); + TclpMasterLock(); + TclpMutexLock(); + fprintf(stderr, "=== StartNotifierThread() locked notifierThreadRunning %d notifierCount %d\n", notifierThreadRunning, notifierCount); + if (!notifierCount) { + Tcl_Panic("StartNotifierThread: notifier not initialized"); + } + if (!notifierThreadRunning) { + fprintf(stderr, "=== StartNotifierThread() really start\n"); + if (TclpThreadCreate(¬ifierThread, NotifierThreadProc, NULL, + TCL_THREAD_STACK_DEFAULT, TCL_THREAD_JOINABLE) != TCL_OK) { + Tcl_Panic("Tcl_InitNotifier: unable to start notifier thread"); + } + processIDInitialized = getpid(); + notifierThreadRunning = 1; + } + TclpMutexUnlock(); + TclpMasterUnlock(); + Tcl_MutexUnlock(¬ifierInitMutex); +} +#endif /* *---------------------------------------------------------------------- @@ -277,11 +319,11 @@ static DWORD __stdcall NotifierProc(void *hwnd, unsigned int message, ClientData Tcl_InitNotifier(void) { + //fprintf(stderr, "==== Tcl_InitNotifier atForkInit %d notifierCount %d\n", atForkInit, notifierCount); if (tclNotifierHooks.initNotifierProc) { return tclNotifierHooks.initNotifierProc(); } else { - ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); - + ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); #ifdef TCL_THREADS tsdPtr->eventReady = 0; @@ -295,9 +337,9 @@ Tcl_InitNotifier(void) * Install pthread_atfork handlers to reinitialize the notifier in the * child of a fork. */ - if (!atForkInit) { int result = pthread_atfork(AtForkPrepare, AtForkParent, AtForkChild); + fprintf(stderr, "==== calling pthread_atfork()\n"); if (result) { Tcl_Panic("Tcl_InitNotifier: pthread_atfork failed"); @@ -310,22 +352,28 @@ Tcl_InitNotifier(void) * In this case, restart the notifier thread and close the * pipe to the original notifier thread */ +#if LAZY_THREAD_CREATE == 0 if (notifierCount > 0 && processIDInitialized != getpid()) { + // fprintf(stderr, "==== reset notifierCount for %d\n", getpid()); Tcl_ConditionFinalize(¬ifierCV); notifierCount = 0; processIDInitialized = 0; close(triggerPipe); triggerPipe = -1; } +#endif if (notifierCount == 0) { +#if LAZY_THREAD_CREATE == 0 if (TclpThreadCreate(¬ifierThread, NotifierThreadProc, NULL, TCL_THREAD_STACK_DEFAULT, TCL_THREAD_JOINABLE) != TCL_OK) { Tcl_Panic("Tcl_InitNotifier: unable to start notifier thread"); } processIDInitialized = getpid(); +#endif } notifierCount++; +#if LAZY_THREAD_CREATE == 0 /* * Wait for the notifier pipe to be created. */ @@ -333,6 +381,7 @@ Tcl_InitNotifier(void) while (triggerPipe < 0) { Tcl_ConditionWait(¬ifierCV, ¬ifierMutex, NULL); } +#endif Tcl_MutexUnlock(¬ifierMutex); #endif /* TCL_THREADS */ @@ -371,6 +420,7 @@ Tcl_FinalizeNotifier( Tcl_MutexLock(¬ifierMutex); notifierCount--; + //fprintf(stderr, "==== Tcl_Tcl_FinalizeNotifier (after decr) atForkInit %d notifierCount %d\n", atForkInit, notifierCount); /* * If this is the last thread to use the notifier, close the notifier @@ -378,8 +428,39 @@ Tcl_FinalizeNotifier( */ if (notifierCount == 0) { +#if LAZY_THREAD_CREATE == 1 + if (triggerPipe != -1) { + if (write(triggerPipe, "q", 1) != 1) { + Tcl_Panic("Tcl_FinalizeNotifier: %s", + "unable to write q to triggerPipe"); + } + close(triggerPipe); + triggerPipe = -1; + + if (notifierThreadRunning) { + int result = Tcl_JoinThread(notifierThread, NULL); + + if (result) { + Tcl_Panic("Tcl_FinalizeNotifier: unable to join notifier " + "thread"); + } + notifierThreadRunning = 0; + } + } +#else int result; +# if AT_FORK_INIT_VALUE == 1 + if (triggerPipe != -1) { + if (write(triggerPipe, "q", 1) != 1) { + Tcl_Panic("Tcl_FinalizeNotifier: %s", + "unable to write q to triggerPipe"); + } + close(triggerPipe); + triggerPipe = -1; + } +# else + if (triggerPipe < 0) { Tcl_Panic("Tcl_FinalizeNotifier: %s", "notifier pipe not initialized"); @@ -410,6 +491,8 @@ Tcl_FinalizeNotifier( Tcl_Panic("Tcl_FinalizeNotifier: %s", "unable to join notifier thread"); } +# endif +#endif } /* @@ -524,11 +607,18 @@ Tcl_ServiceModeHook( int mode) /* Either TCL_SERVICE_ALL, or * TCL_SERVICE_NONE. */ { + fprintf(stderr, "==== Tcl_ServiceModeHook mode %d\n", mode); if (tclNotifierHooks.serviceModeHookProc) { tclNotifierHooks.serviceModeHookProc(mode); return; } else { +#if LAZY_THREAD_CREATE == 1 + if (mode == TCL_SERVICE_ALL) { + StartNotifierThread(); + } +#else /* Does nothing in this implementation. */ +#endif } } @@ -881,6 +971,9 @@ Tcl_WaitForEvent( * Place this thread on the list of interested threads, signal the * notifier thread, and wait for a response or a timeout. */ +#if LAZY_THREAD_CREATE == 1 + StartNotifierThread(); +#endif #ifdef __CYGWIN__ if (!tsdPtr->hwnd) { @@ -1147,6 +1240,7 @@ NotifierThreadProc( "could not make trigger pipe close-on-exec"); } +// fprintf(stderr, "=== Starting Notifier Thread\n"); /* * Install the write end of the pipe into the global variable. */ @@ -1304,6 +1398,7 @@ NotifierThreadProc( * Clean up the read end of the pipe and signal any threads waiting on * termination of the notifier thread. */ +fprintf(stderr, "=== Stopping Notifier Thread\n"); close(receivePipe); Tcl_MutexLock(¬ifierMutex); @@ -1334,9 +1429,11 @@ NotifierThreadProc( static void AtForkPrepare(void) { +#if DEACTIVATE_ATFORK_MUTEX == 0 Tcl_MutexLock(¬ifierMutex); TclpMasterLock(); TclpMutexLock(); +#endif } /* @@ -1358,9 +1455,12 @@ AtForkPrepare(void) static void AtForkParent(void) { +#if DEACTIVATE_ATFORK_MUTEX == 0 TclpMutexUnlock(); TclpMasterUnlock(); Tcl_MutexUnlock(¬ifierMutex); +#endif + //fprintf(stderr, "==== atParent %d notifierCount %d atForkInit %d\n", atForkInit, notifierCount, atForkInit); } /* @@ -1382,9 +1482,25 @@ AtForkParent(void) static void AtForkChild(void) { +#if DEACTIVATE_ATFORK_MUTEX == 0 TclpMutexUnlock(); TclpMasterUnlock(); TclMutexUnlockAndFinalize(¬ifierMutex); +#endif + +#if LAZY_THREAD_CREATE == 1 + //Tcl_MutexLock(¬ifierInitMutex); + notifierThreadRunning = 0; + if (notifierCount > 0) { + Tcl_ConditionFinalize(¬ifierCV); + notifierCount = 0; + processIDInitialized = 0; + close(triggerPipe); + triggerPipe = -1; + } + //Tcl_MutexUnlock(¬ifierInitMutex); +#endif + // fprintf(stderr, "==== AtForkChild() notifierCount %d notifierThreadRunning %d atForkInit %d\n",notifierCount,notifierThreadRunning, atForkInit); Tcl_InitNotifier(); } #endif /* HAVE_PTHREAD_ATFORK */ -- cgit v0.12 From 41107649bba64d4a990d11c0f5c0fa33ed86b66c Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 17 Aug 2015 20:35:15 +0000 Subject: remove superfluous fprintf to stderr. --- unix/tclUnixNotfy.c | 1 - 1 file changed, 1 deletion(-) diff --git a/unix/tclUnixNotfy.c b/unix/tclUnixNotfy.c index 398e13a..0493ee4 100644 --- a/unix/tclUnixNotfy.c +++ b/unix/tclUnixNotfy.c @@ -283,7 +283,6 @@ StartNotifierThread(void) pthread_mutex_lock(¬ifierInitMutex); if (!notifierThreadRunning) { - fprintf(stderr, "=== StartNotifierThread()\n"); if (TclpThreadCreate(¬ifierThread, NotifierThreadProc, NULL, TCL_THREAD_STACK_DEFAULT, TCL_THREAD_JOINABLE) != TCL_OK) { Tcl_Panic("Tcl_InitNotifier: unable to start notifier thread"); -- cgit v0.12 From 1be28d5783ffb769754d37da7a745fb737f7f817 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 2 Sep 2015 11:54:58 +0000 Subject: Fix the Cygwin notifier, doing the initialization of the thread-local variables exactly the same as the Unix notifier. --- unix/tclUnixNotfy.c | 74 ++++++++++++++++++++++++----------------------------- 1 file changed, 33 insertions(+), 41 deletions(-) diff --git a/unix/tclUnixNotfy.c b/unix/tclUnixNotfy.c index dc6c6fd..c873774 100644 --- a/unix/tclUnixNotfy.c +++ b/unix/tclUnixNotfy.c @@ -103,8 +103,8 @@ typedef struct ThreadSpecificData { pthread_cond_t waitCV; /* Any other thread alerts a notifier that an * event is ready to be processed by signaling * this condition variable. */ - int waitCVinitialized; /* Variable to flag initialization of the structure */ #endif /* __CYGWIN__ */ + int waitCVinitialized; /* Variable to flag initialization of the structure */ int eventReady; /* True if an event is ready to be processed. * Used as condition flag together with waitCV * above. */ @@ -254,9 +254,10 @@ extern unsigned char __stdcall ResetEvent(void *); extern unsigned char __stdcall TranslateMessage(const MSG *); /* - * Threaded-cygwin specific functions in this file: + * Threaded-cygwin specific constants and functions in this file: */ +static const WCHAR NotfyClassName[] = L"TclNotifier"; static DWORD __stdcall NotifierProc(void *hwnd, unsigned int message, void *wParam, void *lParam); #endif /* TCL_THREADS && __CYGWIN__ */ @@ -331,15 +332,35 @@ Tcl_InitNotifier(void) #ifdef TCL_THREADS tsdPtr->eventReady = 0; -#ifndef __CYGWIN__ /* * Initialize thread specific condition variable for this thread. */ if (tsdPtr->waitCVinitialized == 0) { +#ifdef __CYGWIN__ + WNDCLASS class; + + class.style = 0; + class.cbClsExtra = 0; + class.cbWndExtra = 0; + class.hInstance = TclWinGetTclInstance(); + class.hbrBackground = NULL; + class.lpszMenuName = NULL; + class.lpszClassName = NotfyClassName; + class.lpfnWndProc = NotifierProc; + class.hIcon = NULL; + class.hCursor = NULL; + + RegisterClassW(&class); + tsdPtr->hwnd = CreateWindowExW(NULL, class.lpszClassName, + class.lpszClassName, 0, 0, 0, 0, 0, NULL, NULL, + TclWinGetTclInstance(), NULL); + tsdPtr->event = CreateEventW(NULL, 1 /* manual */, + 0 /* !signaled */, NULL); +#else pthread_cond_init(&tsdPtr->waitCV, NULL); +#endif /* __CYGWIN */ tsdPtr->waitCVinitialized = 1; } -#endif pthread_mutex_lock(¬ifierInitMutex); #if defined(HAVE_PTHREAD_ATFORK) && !defined(__APPLE__) && !defined(__hpux) @@ -403,9 +424,7 @@ Tcl_FinalizeNotifier( * Check if FinializeNotifier was called without a prior InitNotifier * in this thread. */ -#ifndef __CYGWIN__ assert(tsdPtr->waitCVinitialized == 1); -#endif /* * If this is the last thread to use the notifier, close the notifier @@ -440,10 +459,12 @@ Tcl_FinalizeNotifier( */ #ifdef __CYGWIN__ + DestroyWindow(tsdPtr->hwnd); CloseHandle(tsdPtr->event); #else /* __CYGWIN__ */ pthread_cond_destroy(&tsdPtr->waitCV); #endif /* __CYGWIN__ */ + tsdPtr->waitCVinitialized = 0; pthread_mutex_unlock(¬ifierInitMutex); #endif /* TCL_THREADS */ @@ -595,9 +616,7 @@ Tcl_CreateFileHandler( /* * Check if InitNotifier was called before in this thread */ -#ifndef __CYGWIN__ assert(tsdPtr->waitCVinitialized == 1); -#endif for (filePtr = tsdPtr->firstFileHandlerPtr; filePtr != NULL; filePtr = filePtr->nextPtr) { if (filePtr->fd == fd) { @@ -672,9 +691,7 @@ Tcl_DeleteFileHandler( /* * Check if InitNotifier was called before in this thread */ -#ifndef __CYGWIN__ assert(tsdPtr->waitCVinitialized == 1); -#endif /* * Find the entry for the given file (and return if there isn't one). @@ -784,9 +801,7 @@ FileHandlerEventProc( /* * Check if InitNotifier was called before in this thread */ -#ifndef __CYGWIN__ assert(tsdPtr->waitCVinitialized == 1); -#endif for (filePtr = tsdPtr->firstFileHandlerPtr; filePtr != NULL; filePtr = filePtr->nextPtr) { @@ -889,9 +904,7 @@ Tcl_WaitForEvent( /* * Check if InitNotifier was called before in this thread */ -#ifndef __CYGWIN__ assert(tsdPtr->waitCVinitialized == 1); -#endif /* * Set up the timeout structure. Note that if there are no events to @@ -938,30 +951,6 @@ Tcl_WaitForEvent( */ StartNotifierThread(); -#ifdef __CYGWIN__ - if (!tsdPtr->hwnd) { - WNDCLASS class; - - class.style = 0; - class.cbClsExtra = 0; - class.cbWndExtra = 0; - class.hInstance = TclWinGetTclInstance(); - class.hbrBackground = NULL; - class.lpszMenuName = NULL; - class.lpszClassName = L"TclNotifier"; - class.lpfnWndProc = NotifierProc; - class.hIcon = NULL; - class.hCursor = NULL; - - RegisterClassW(&class); - tsdPtr->hwnd = CreateWindowExW(NULL, class.lpszClassName, - class.lpszClassName, 0, 0, 0, 0, 0, NULL, NULL, - TclWinGetTclInstance(), NULL); - tsdPtr->event = CreateEventW(NULL, 1 /* manual */, - 0 /* !signaled */, NULL); - } -#endif /* __CYGWIN */ - pthread_mutex_lock(¬ifierMutex); if (timePtr != NULL && timePtr->sec == 0 && (timePtr->usec == 0 @@ -1471,9 +1460,7 @@ AtForkChild(void) notifierCount = 0; if (notifierThreadRunning == 1) { -#ifndef __CYGWIN__ ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); -#endif notifierThreadRunning = 0; close(triggerPipe); @@ -1489,8 +1476,13 @@ AtForkChild(void) * The tsdPtr from before the fork is copied as well. But since * we are paranoic, we don't trust its condvar and reset it. */ -#ifndef __CYGWIN__ assert(tsdPtr->waitCVinitialized == 1); +#ifdef __CYGWIN__ + tsdPtr->hwnd = CreateWindowExW(NULL, NotfyClassName, + NotfyClassName, 0, 0, 0, 0, 0, NULL, NULL, + TclWinGetTclInstance(), NULL); + ResetEvent(tsdPtr->event); +#else pthread_cond_destroy(&tsdPtr->waitCV); pthread_cond_init(&tsdPtr->waitCV, NULL); #endif -- cgit v0.12 From 69d6754d432cdf6e463254245e8f10085cd1f70d Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 3 Sep 2015 09:39:43 +0000 Subject: In StartNotifierThread() don't lock mutex if thread is already started. Fix panic message if thread cannot be started. Remove asserts used for debugging. --- unix/tclUnixNotfy.c | 72 ++++++++++++++++------------------------------------- 1 file changed, 22 insertions(+), 50 deletions(-) diff --git a/unix/tclUnixNotfy.c b/unix/tclUnixNotfy.c index c873774..2d5a560 100644 --- a/unix/tclUnixNotfy.c +++ b/unix/tclUnixNotfy.c @@ -17,7 +17,6 @@ #ifndef HAVE_COREFOUNDATION /* Darwin/Mac OS X CoreFoundation notifier is * in tclMacOSXNotify.c */ #include -#include /* * This structure is used to keep track of the notifier info for a registered @@ -279,29 +278,30 @@ static DWORD __stdcall NotifierProc(void *hwnd, unsigned int message, *---------------------------------------------------------------------- */ static void -StartNotifierThread(void) +StartNotifierThread(const char *proc) { - - pthread_mutex_lock(¬ifierInitMutex); if (!notifierThreadRunning) { - if (TclpThreadCreate(¬ifierThread, NotifierThreadProc, NULL, - TCL_THREAD_STACK_DEFAULT, TCL_THREAD_JOINABLE) != TCL_OK) { - Tcl_Panic("Tcl_InitNotifier: unable to start notifier thread"); - } + pthread_mutex_lock(¬ifierInitMutex); + if (!notifierThreadRunning) { + if (TclpThreadCreate(¬ifierThread, NotifierThreadProc, NULL, + TCL_THREAD_STACK_DEFAULT, TCL_THREAD_JOINABLE) != TCL_OK) { + Tcl_Panic("%s: unable to start notifier thread", proc); + } - pthread_mutex_lock(¬ifierMutex); - /* - * Wait for the notifier pipe to be created. - */ + pthread_mutex_lock(¬ifierMutex); + /* + * Wait for the notifier pipe to be created. + */ - while (triggerPipe < 0) { - pthread_cond_wait(¬ifierCV, ¬ifierMutex); - } - pthread_mutex_unlock(¬ifierMutex); + while (triggerPipe < 0) { + pthread_cond_wait(¬ifierCV, ¬ifierMutex); + } + pthread_mutex_unlock(¬ifierMutex); - notifierThreadRunning = 1; + notifierThreadRunning = 1; + } + pthread_mutex_unlock(¬ifierInitMutex); } - pthread_mutex_unlock(¬ifierInitMutex); } #endif /* TCL_THREADS */ @@ -358,7 +358,7 @@ Tcl_InitNotifier(void) 0 /* !signaled */, NULL); #else pthread_cond_init(&tsdPtr->waitCV, NULL); -#endif /* __CYGWIN */ +#endif /* __CYGWIN__ */ tsdPtr->waitCVinitialized = 1; } @@ -421,12 +421,6 @@ Tcl_FinalizeNotifier( notifierCount--; /* - * Check if FinializeNotifier was called without a prior InitNotifier - * in this thread. - */ - assert(tsdPtr->waitCVinitialized == 1); - - /* * If this is the last thread to use the notifier, close the notifier * pipe and wait for the background thread to terminate. */ @@ -574,7 +568,7 @@ Tcl_ServiceModeHook( return; } else if (mode == TCL_SERVICE_ALL) { #if TCL_THREADS - StartNotifierThread(); + StartNotifierThread("Tcl_ServiceModeHook"); #endif } } @@ -613,10 +607,6 @@ Tcl_CreateFileHandler( ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); FileHandler *filePtr; - /* - * Check if InitNotifier was called before in this thread - */ - assert(tsdPtr->waitCVinitialized == 1); for (filePtr = tsdPtr->firstFileHandlerPtr; filePtr != NULL; filePtr = filePtr->nextPtr) { if (filePtr->fd == fd) { @@ -689,11 +679,6 @@ Tcl_DeleteFileHandler( ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); /* - * Check if InitNotifier was called before in this thread - */ - assert(tsdPtr->waitCVinitialized == 1); - - /* * Find the entry for the given file (and return if there isn't one). */ @@ -798,11 +783,6 @@ FileHandlerEventProc( tsdPtr = TCL_TSD_INIT(&dataKey); - /* - * Check if InitNotifier was called before in this thread - */ - assert(tsdPtr->waitCVinitialized == 1); - for (filePtr = tsdPtr->firstFileHandlerPtr; filePtr != NULL; filePtr = filePtr->nextPtr) { if (filePtr->fd != fileEvPtr->fd) { @@ -902,11 +882,6 @@ Tcl_WaitForEvent( ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); /* - * Check if InitNotifier was called before in this thread - */ - assert(tsdPtr->waitCVinitialized == 1); - - /* * Set up the timeout structure. Note that if there are no events to * check for, we return with a negative result rather than blocking * forever. @@ -949,7 +924,7 @@ Tcl_WaitForEvent( * interested threads, signal the notifier thread, and wait for a * response or a timeout. */ - StartNotifierThread(); + StartNotifierThread("Tcl_WaitForEvent"); pthread_mutex_lock(¬ifierMutex); @@ -1476,8 +1451,8 @@ AtForkChild(void) * The tsdPtr from before the fork is copied as well. But since * we are paranoic, we don't trust its condvar and reset it. */ - assert(tsdPtr->waitCVinitialized == 1); #ifdef __CYGWIN__ + DestroyWindow(tsdPtr->hwnd); tsdPtr->hwnd = CreateWindowExW(NULL, NotfyClassName, NotfyClassName, 0, 0, 0, 0, 0, NULL, NULL, TclWinGetTclInstance(), NULL); @@ -1492,9 +1467,6 @@ AtForkChild(void) */ } } - assert(notifierCount == 0); - assert(triggerPipe == -1); - assert(waitingListPtr == NULL); Tcl_InitNotifier(); } -- cgit v0.12 From 00e36faa85d26704fb289ee399cad3c810c0eaa2 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 7 Sep 2015 08:35:42 +0000 Subject: Fix for [5d170b5ca5] now available for widespread testing (incl. HPUX and OSX) --- unix/tclUnixNotfy.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/unix/tclUnixNotfy.c b/unix/tclUnixNotfy.c index f942329..90f478b 100644 --- a/unix/tclUnixNotfy.c +++ b/unix/tclUnixNotfy.c @@ -196,7 +196,7 @@ static Tcl_ThreadId notifierThread; #ifdef TCL_THREADS static void NotifierThreadProc(ClientData clientData); -#if defined(HAVE_PTHREAD_ATFORK) && !defined(__APPLE__) && !defined(__hpux) +#if defined(HAVE_PTHREAD_ATFORK) static int atForkInit = AT_FORK_INIT_VALUE; static void AtForkPrepare(void); static void AtForkParent(void); @@ -363,7 +363,7 @@ Tcl_InitNotifier(void) } pthread_mutex_lock(¬ifierInitMutex); -#if defined(HAVE_PTHREAD_ATFORK) && !defined(__APPLE__) && !defined(__hpux) +#if defined(HAVE_PTHREAD_ATFORK) /* * Install pthread_atfork handlers to clean up the notifier in the * child of a fork. @@ -1345,7 +1345,7 @@ NotifierThreadProc( TclpThreadExit(0); } -#if defined(HAVE_PTHREAD_ATFORK) && !defined(__APPLE__) && !defined(__hpux) +#if defined(HAVE_PTHREAD_ATFORK) /* *---------------------------------------------------------------------- * -- cgit v0.12