diff options
Diffstat (limited to 'src/pulsecore')
-rw-r--r-- | src/pulsecore/thread-posix.c | 9 | ||||
-rw-r--r-- | src/pulsecore/thread.h | 1 |
2 files changed, 10 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; diff --git a/src/pulsecore/thread.h b/src/pulsecore/thread.h index 978e9927..9b99c8c2 100644 --- a/src/pulsecore/thread.h +++ b/src/pulsecore/thread.h @@ -33,6 +33,7 @@ void pa_thread_free(pa_thread *t); int pa_thread_join(pa_thread *t); int pa_thread_is_running(pa_thread *t); pa_thread *pa_thread_self(void); +void pa_thread_yield(void); typedef struct pa_tls pa_tls; |