summaryrefslogtreecommitdiff
path: root/thread.h
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>1998-10-19 09:15:53 +0000
committerJarkko Hietaniemi <jhi@iki.fi>1998-10-19 09:15:53 +0000
commite7a4f449b8d928b435cf6dc0ee7260fd628fd9e0 (patch)
tree1b40ee0ec13cdcc4ef3365bf16c242ece2e0e325 /thread.h
parent4a07db3e6be903a5c002af0bdc1fe318f4d66315 (diff)
downloadperl-e7a4f449b8d928b435cf6dc0ee7260fd628fd9e0.tar.gz
YIELD more robustly.
p4raw-id: //depot/cfgperl@2020
Diffstat (limited to 'thread.h')
-rw-r--r--thread.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/thread.h b/thread.h
index f883ced905..dafaa1ea68 100644
--- a/thread.h
+++ b/thread.h
@@ -25,7 +25,19 @@
#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