summaryrefslogtreecommitdiffstats
path: root/macosx/tclMacOSXNotify.c
diff options
context:
space:
mode:
authordas <das>2007-06-23 00:23:42 (GMT)
committerdas <das>2007-06-23 00:23:42 (GMT)
commita384f578db158e03a8216ded58a85f751f9bc2a4 (patch)
treeb9f63c6b23375f265d7323f0835ac70f7b4650bd /macosx/tclMacOSXNotify.c
parentc0eed741bb105f7eee2f2a4e2764e489a7972a37 (diff)
downloadtcl-a384f578db158e03a8216ded58a85f751f9bc2a4.zip
tcl-a384f578db158e03a8216ded58a85f751f9bc2a4.tar.gz
tcl-a384f578db158e03a8216ded58a85f751f9bc2a4.tar.bz2
* macosx/tclMacOSXNotify.c (AtForkChild): don't call CoreFoundation
APIs after fork() on systems where that would lead to an abort().
Diffstat (limited to 'macosx/tclMacOSXNotify.c')
-rw-r--r--macosx/tclMacOSXNotify.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/macosx/tclMacOSXNotify.c b/macosx/tclMacOSXNotify.c
index ea94e8e..e6ae7b3 100644
--- a/macosx/tclMacOSXNotify.c
+++ b/macosx/tclMacOSXNotify.c
@@ -12,7 +12,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.1.2.12 2007/04/29 02:21:33 das Exp $
+ * RCS: @(#) $Id: tclMacOSXNotify.c,v 1.1.2.13 2007/06/23 00:23:42 das Exp $
*/
#include "tclInt.h"
@@ -289,6 +289,21 @@ static void AtForkChild(void);
extern int pthread_atfork(void (*prepare)(void), void (*parent)(void),
void (*child)(void)) WEAK_IMPORT_ATTRIBUTE;
#endif /* HAVE_WEAK_IMPORT */
+#ifdef __LP64__
+/*
+ * On 64bit Darwin 9 and later, it is not possible to call CoreFoundation after
+ * a fork.
+ */
+#if !defined(MAC_OS_X_VERSION_MIN_REQUIRED) ||
+ MAC_OS_X_VERSION_MIN_REQUIRED < 1050
+MODULE_SCOPE long tclMacOSXDarwinRelease;
+#define noCFafterFork (tclMacOSXDarwinRelease >= 9)
+#else /* MAC_OS_X_VERSION_MIN_REQUIRED */
+#define noCFafterFork 1
+#endif /* MAC_OS_X_VERSION_MIN_REQUIRED */
+#else /* __LP64__ */
+#define noCFafterFork 0
+#endif /* __LP64__ */
#endif /* HAVE_PTHREAD_ATFORK */
/*
@@ -1257,7 +1272,9 @@ AtForkChild(void)
UNLOCK_NOTIFIER_INIT;
if (tsdPtr->runLoop) {
tsdPtr->runLoop = NULL;
- CFRunLoopSourceInvalidate(tsdPtr->runLoopSource);
+ if (!noCFafterFork) {
+ CFRunLoopSourceInvalidate(tsdPtr->runLoopSource);
+ }
CFRelease(tsdPtr->runLoopSource);
tsdPtr->runLoopSource = NULL;
}
@@ -1273,7 +1290,9 @@ AtForkChild(void)
* Tcl_AlertNotifier may break in the child.
*/
- Tcl_InitNotifier();
+ if (!noCFafterFork) {
+ Tcl_InitNotifier();
+ }
}
}
#endif /* HAVE_PTHREAD_ATFORK */