summaryrefslogtreecommitdiffstats
path: root/src/pulsecore/thread-posix.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/pulsecore/thread-posix.c')
-rw-r--r--src/pulsecore/thread-posix.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/pulsecore/thread-posix.c b/src/pulsecore/thread-posix.c
index 6ca46d70..4c12ec93 100644
--- a/src/pulsecore/thread-posix.c
+++ b/src/pulsecore/thread-posix.c
@@ -25,6 +25,7 @@
#include <assert.h>
#include <pthread.h>
+#include <sched.h>
#include <atomic_ops.h>
@@ -116,6 +117,14 @@ pa_thread* pa_thread_self(void) {
return pa_tls_get(thread_tls);
}
+void pa_thread_yield(void) {
+#ifdef HAVE_PTHREAD_YIELD
+ pthread_yield();
+#else
+ sched_yield();
+#endif
+}
+
pa_tls* pa_tls_new(pa_free_cb_t free_cb) {
pa_tls *t;