Tcl Source Code

Artifact [7bcb0a7365]
Login

Artifact 7bcb0a73659df507ba83c288e84de34e66c1720cebf0f259b7d141177a3b703b:

Attachment "macos-tip511.diff" to ticket [d1bf3f53a6] added by chw 2021-08-18 19:13:31.
Index: macosx/tclMacOSXNotify.c
==================================================================
--- macosx/tclMacOSXNotify.c
+++ macosx/tclMacOSXNotify.c
@@ -1905,11 +1905,11 @@
  */
 
 int
 TclAsyncNotifier(
     int sigNumber,		/* Signal number. */
-    Tcl_ThreadId threadId,	/* Target thread. */
+    TCL_UNUSED(Tcl_ThreadId),	/* Target thread. */
     TCL_UNUSED(ClientData),	/* Notifier data. */
     int *flagPtr,		/* Flag to mark. */
     int value)			/* Value of mark. */
 {
 #if TCL_THREADS
@@ -2219,16 +2219,21 @@
      * parent the child will exit with an illegal instruction error.  So we
      * reinitialize the lock in the child rather than attempt to unlock it.
      */
 
 #if defined(USE_OS_UNFAIR_LOCK)
-    tsdPtr->tsdLock = OS_UNFAIR_LOCK_INIT;
+    notifierInitLock = OS_UNFAIR_LOCK_INIT;
+    notifierLock     = OS_UNFAIR_LOCK_INIT;
+    tsdPtr->tsdLock  = OS_UNFAIR_LOCK_INIT;
 #else
-       UNLOCK_NOTIFIER_TSD;
-       UNLOCK_NOTIFIER;
-       UNLOCK_NOTIFIER_INIT;
+    UNLOCK_NOTIFIER_TSD;
+    UNLOCK_NOTIFIER;
+    UNLOCK_NOTIFIER_INIT;
 #endif
+
+    asyncPending = 0;
+
     if (tsdPtr->runLoop) {
 	tsdPtr->runLoop = NULL;
 	if (!noCFafterFork) {
 	    CFRunLoopSourceInvalidate(tsdPtr->runLoopSource);
 	    CFRelease(tsdPtr->runLoopSource);
@@ -2254,17 +2259,17 @@
 	 */
 
 	if (!noCFafterFork) {
 	    Tcl_InitNotifier();
 	}
-    }
 
-    /*
-     * Restart the notifier thread for signal handling.
-     */
+	/*
+	 * Restart the notifier thread for signal handling.
+	 */
 
-    StartNotifierThread();
+	StartNotifierThread();
+    }
 }
 #endif /* HAVE_PTHREAD_ATFORK */
 
 #else /* HAVE_COREFOUNDATION */