From 689380c8d2a1a47c3dcf1c67561d18efe1b85489 Mon Sep 17 00:00:00 2001 From: das Date: Sat, 23 Jun 2007 00:23:30 +0000 Subject: * macosx/tclMacOSXNotify.c (AtForkChild): don't call CoreFoundation APIs after fork() on systems where that would lead to an abort(). --- ChangeLog | 14 +++++++++----- macosx/tclMacOSXNotify.c | 25 ++++++++++++++++++++++--- 2 files changed, 31 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 06264ea..f13c5b6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-06-23 Daniel Steffen + + * macosx/tclMacOSXNotify.c (AtForkChild): don't call CoreFoundation + APIs after fork() on systems where that would lead to an abort(). + 2007-06-22 Don Porter * generic/tclExecute.c: Revised TclStackRealloc() signature to better @@ -11,9 +16,9 @@ 2007-06-21 Don Porter - * generic/tclBasic.c: Move most instances of the Tcl_Parse struct - * generic/tclCompExpr.c: off the C stack and onto the Tcl stack. - * generic/tclCompile.c: This is a rather large struct (> 3kB). + * generic/tclBasic.c: Move most instances of the Tcl_Parse struct + * generic/tclCompExpr.c: off the C stack and onto the Tcl stack. + * generic/tclCompile.c: This is a rather large struct (> 3kB). * generic/tclParse.c: 2007-06-21 Miguel Sofer @@ -21,8 +26,7 @@ * generic/tclBasic.c (TEOvI): Made sure that leave * generic/tclExecute.c (INST_INVOKE): traces that were created * tests/trace.test (trace-36.2): during execution of an - originally untraced command do not fire [Bug 1740962], partial - fix. + originally untraced command do not fire [Bug 1740962], partial fix. 2007-06-21 Donal K. Fellows diff --git a/macosx/tclMacOSXNotify.c b/macosx/tclMacOSXNotify.c index be3b162..04171c7 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.14 2007/04/23 20:46:14 das Exp $ + * RCS: @(#) $Id: tclMacOSXNotify.c,v 1.15 2007/06/23 00:23:30 das Exp $ */ #include "tclInt.h" @@ -319,6 +319,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 */ /* @@ -1314,7 +1329,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; } @@ -1330,7 +1347,9 @@ AtForkChild(void) * Tcl_AlertNotifier may break in the child. */ - Tcl_InitNotifier(); + if (!noCFafterFork) { + Tcl_InitNotifier(); + } } } #endif /* HAVE_PTHREAD_ATFORK */ -- cgit v0.12