summaryrefslogtreecommitdiff
path: root/lib/isc/pthreads/thread.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/isc/pthreads/thread.c')
-rw-r--r--lib/isc/pthreads/thread.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/isc/pthreads/thread.c b/lib/isc/pthreads/thread.c
index 1b250fac2801..97821a2cadb0 100644
--- a/lib/isc/pthreads/thread.c
+++ b/lib/isc/pthreads/thread.c
@@ -21,6 +21,10 @@
#include <config.h>
+#if defined(HAVE_SCHED_H)
+#include <sched.h>
+#endif
+
#include <isc/thread.h>
#include <isc/util.h>
@@ -74,3 +78,14 @@ isc_thread_setconcurrency(unsigned int level) {
UNUSED(level);
#endif
}
+
+void
+isc_thread_yield(void) {
+#if defined(HAVE_SCHED_YIELD)
+ sched_yield();
+#elif defined( HAVE_PTHREAD_YIELD)
+ pthread_yield();
+#elif defined( HAVE_PTHREAD_YIELD_NP)
+ pthread_yield_np();
+#endif
+}