summaryrefslogtreecommitdiffstats
path: root/macosx/tclMacOSXNotify.c
diff options
context:
space:
mode:
Diffstat (limited to 'macosx/tclMacOSXNotify.c')
-rw-r--r--macosx/tclMacOSXNotify.c40
1 files changed, 21 insertions, 19 deletions
diff --git a/macosx/tclMacOSXNotify.c b/macosx/tclMacOSXNotify.c
index 6d892ea..6dfb379 100644
--- a/macosx/tclMacOSXNotify.c
+++ b/macosx/tclMacOSXNotify.c
@@ -13,7 +13,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclMacOSXNotify.c,v 1.8 2006/07/20 06:18:37 das Exp $
+ * RCS: @(#) $Id: tclMacOSXNotify.c,v 1.9 2006/08/10 12:15:32 dkf Exp $
*/
#include "tclInt.h"
@@ -179,7 +179,7 @@ static void SpinLockLockInit(void) {
lockLock = OSSpinLockLock != NULL ? OSSpinLockLock : _spin_lock;
lockUnlock = OSSpinLockUnlock != NULL ? OSSpinLockUnlock : _spin_unlock;
if (lockLock == NULL || lockUnlock == NULL) {
- Tcl_Panic("SpinLockLockInit: no spinlock API available.");
+ Tcl_Panic("SpinLockLockInit: no spinlock API available");
}
}
#define SpinLockLock(p) lockLock(p)
@@ -284,7 +284,7 @@ Tcl_InitNotifier(void)
* Initialize support for weakly imported spinlock API.
*/
if (pthread_once(&spinLockLockInitControl, SpinLockLockInit)) {
- Tcl_Panic("Tcl_InitNotifier: pthread_once failed.");
+ Tcl_Panic("Tcl_InitNotifier: pthread_once failed");
}
#endif
@@ -301,7 +301,7 @@ Tcl_InitNotifier(void)
runLoopSourceContext.info = tsdPtr;
runLoopSource = CFRunLoopSourceCreate(NULL, 0, &runLoopSourceContext);
if (!runLoopSource) {
- Tcl_Panic("Tcl_InitNotifier: could not create CFRunLoopSource.");
+ Tcl_Panic("Tcl_InitNotifier: could not create CFRunLoopSource");
}
CFRunLoopAddSource(runLoop, runLoopSource, kCFRunLoopCommonModes);
tsdPtr->runLoopSource = runLoopSource;
@@ -321,8 +321,8 @@ Tcl_InitNotifier(void)
#endif
!atForkInit) {
int result = pthread_atfork(AtForkPrepare, AtForkParent, AtForkChild);
- if (result) {
- Tcl_Panic("Tcl_InitNotifier: pthread_atfork failed.");
+ if (result) {
+ Tcl_Panic("Tcl_InitNotifier: pthread_atfork failed");
}
atForkInit = 1;
}
@@ -335,18 +335,18 @@ Tcl_InitNotifier(void)
*/
if (pipe(fds) != 0) {
- Tcl_Panic("Tcl_InitNotifier: could not create trigger pipe.");
+ Tcl_Panic("Tcl_InitNotifier: could not create trigger pipe");
}
status = fcntl(fds[0], F_GETFL);
status |= O_NONBLOCK;
if (fcntl(fds[0], F_SETFL, status) < 0) {
- Tcl_Panic("Tcl_InitNotifier: could not make receive pipe non blocking.");
+ Tcl_Panic("Tcl_InitNotifier: could not make receive pipe non blocking");
}
status = fcntl(fds[1], F_GETFL);
status |= O_NONBLOCK;
if (fcntl(fds[1], F_SETFL, status) < 0) {
- Tcl_Panic("Tcl_InitNotifier: could not make trigger pipe non blocking.");
+ Tcl_Panic("Tcl_InitNotifier: could not make trigger pipe non blocking");
}
receivePipe = fds[0];
@@ -357,7 +357,7 @@ Tcl_InitNotifier(void)
* interfering with fork() followed immediately by execve()
* (cannot execve() when more than one thread is present).
*/
-
+
notifierThread = 0;
}
notifierCount++;
@@ -402,7 +402,7 @@ Tcl_FinalizeNotifier(
int result;
if (triggerPipe < 0) {
- Tcl_Panic("Tcl_FinalizeNotifier: notifier pipe not initialized.");
+ Tcl_Panic("Tcl_FinalizeNotifier: notifier pipe not initialized");
}
/*
@@ -422,7 +422,7 @@ Tcl_FinalizeNotifier(
if (notifierThread) {
result = pthread_join(notifierThread, NULL);
if (result) {
- Tcl_Panic("Tcl_FinalizeNotifier: unable to join notifier thread.");
+ Tcl_Panic("Tcl_FinalizeNotifier: unable to join notifier thread");
}
notifierThread = 0;
}
@@ -844,7 +844,7 @@ Tcl_WaitForEvent(
(void * (*)(void *))NotifierThreadProc, NULL);
pthread_attr_destroy(&attr);
if (result || !notifierThread) {
- Tcl_Panic("Tcl_WaitForEvent: unable to start notifier thread.");
+ Tcl_Panic("Tcl_WaitForEvent: unable to start notifier thread");
}
}
UNLOCK_NOTIFIER_INIT;
@@ -1224,14 +1224,16 @@ AtForkChild(void)
}
if (notifierCount > 0) {
notifierCount = 0;
+
/*
- * Assume that the return value of Tcl_InitNotifier() in the child
- * will be identical to the one stored as clientData in tclNotify.c's
- * ThreadSpecificData by the parent's TclInitNotifier(), so discard
- * the return value here. This assumption may require the fork() to
- * be executed in the main thread of the parent, otherwise
- * Tcl_AlertNotifier() may break in the child.
+ * Assume that the return value of Tcl_InitNotifier in the child will
+ * be identical to the one stored as clientData in tclNotify.c's
+ * ThreadSpecificData by the parent's TclInitNotifier, so discard the
+ * return value here. This assumption may require the fork() to be
+ * executed in the main thread of the parent, otherwise
+ * Tcl_AlertNotifier may break in the child.
*/
+
Tcl_InitNotifier();
}
}