YIELD more robustly.
Jarkko Hietaniemi [Mon, 19 Oct 1998 09:15:53 +0000 (09:15 +0000)]
p4raw-id: //depot/cfgperl@2020

thread.h

index f883ced..dafaa1e 100644 (file)
--- a/thread.h
+++ b/thread.h
 #endif
 
 #ifndef YIELD
-#  define YIELD SCHED_YIELD
+#  ifdef SCHED_YIELD
+#    define YIELD SCHED_YIELD
+#  else
+#    ifdef HAS_SCHED_YIELD
+#      define YIELD sched_yield()
+#    else
+#      ifdef HAS_PTHREAD_YIELD
+    /* pthread_yield(NULL) platforms are expected
+     * to have #defined YIELD for themselves. */
+#        define YIELD pthread_yield()
+#      endif
+#    endif
+#  endif
 #endif
 
 #ifdef PTHREAD_CREATE_JOINABLE