summaryrefslogtreecommitdiff
path: root/threadproc
diff options
context:
space:
mode:
authorrooneg <rooneg@13f79535-47bb-0310-9956-ffa450edef68>2006-06-30 18:14:21 +0000
committerrooneg <rooneg@13f79535-47bb-0310-9956-ffa450edef68>2006-06-30 18:14:21 +0000
commit5faca2a81fd2d3f36a394831044e61b02928c497 (patch)
tree6acb01e30fe8af5b9a9926081d1d5bd067d023d2 /threadproc
parent75074295568cf743c3da63f21ffa8e9a7e37bcaa (diff)
downloadlibapr-5faca2a81fd2d3f36a394831044e61b02928c497.tar.gz
Implement apr_thread_yield on Unix in terms of pthread_yield or sched_yield.
Submitted by: Keisuke Nishida <keisuke.nishida gmail.com> Reviewed by: rooneg, Henry Jen <henryjen ztune.net> * configure.in: Look for pthread_yield and sched_yield. * include/arch/unix/apr_arch_threadproc.h: Include sched.h if it's present. * threadproc/unix/thread.c (apr_thread_yield): Actually do something in here... * CHANGES: Note change. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@418351 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'threadproc')
-rw-r--r--threadproc/unix/thread.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/threadproc/unix/thread.c b/threadproc/unix/thread.c
index c32869c60..a6d671b9c 100644
--- a/threadproc/unix/thread.c
+++ b/threadproc/unix/thread.c
@@ -245,8 +245,15 @@ APR_DECLARE(apr_status_t) apr_thread_detach(apr_thread_t *thd)
}
}
-void apr_thread_yield()
+APR_DECLARE(void) apr_thread_yield(void)
{
+#ifdef HAVE_PTHREAD_YIELD
+ pthread_yield();
+#else
+#ifdef HAVE_SCHED_YIELD
+ sched_yield();
+#endif
+#endif
}
APR_DECLARE(apr_status_t) apr_thread_data_get(void **data, const char *key,