Revision: 50 http://trac.macosforge.org/projects/libdispatch/changeset/50 Author: robert@fledge.watson.org Date: 2009-10-03 06:31:32 -0700 (Sat, 03 Oct 2009) Log Message: ----------- Detect pthread_main_np() in configure, and only use if defined. For non-supporting platforms, it would be advantageous to provide a compat interface. Modified Paths: -------------- trunk/configure.ac trunk/src/queue.c Modified: trunk/configure.ac =================================================================== --- trunk/configure.ac 2009-10-03 13:24:53 UTC (rev 49) +++ trunk/configure.ac 2009-10-03 13:31:32 UTC (rev 50) @@ -178,7 +178,7 @@ [[#include <sys/event.h>]]) AC_CHECK_DECLS([SIGEMT], [], [], [[#include <signal.h>]]) AC_CHECK_DECLS([VQ_UPDATE, VQ_VERYLOWDISK], [], [], [[#include <sys/mount.h>]]) -AC_CHECK_FUNCS([pthread_key_init_np mach_absolute_time malloc_create_zone sem_init]) +AC_CHECK_FUNCS([pthread_key_init_np pthread_main_np mach_absolute_time malloc_create_zone sem_init]) # # Does the platform support __private_extern__? There is surely a better way Modified: trunk/src/queue.c =================================================================== --- trunk/src/queue.c 2009-10-03 13:24:53 UTC (rev 49) +++ trunk/src/queue.c 2009-10-03 13:31:32 UTC (rev 50) @@ -896,12 +896,17 @@ void dispatch_main(void) { + +#ifdef HAVE_PTHREAD_MAIN_NP if (pthread_main_np()) { +#endif _dispatch_program_is_probably_callback_driven = true; pthread_exit(NULL); DISPATCH_CRASH("pthread_exit() returned"); +#ifdef HAVE_PTHREAD_MAIN_NP } DISPATCH_CLIENT_CRASH("dispatch_main() must be called on the main thread"); +#endif } static void
participants (1)
-
source_changes@macosforge.org