summaryrefslogtreecommitdiff
path: root/vp8/common/threading.h
diff options
context:
space:
mode:
Diffstat (limited to 'vp8/common/threading.h')
-rw-r--r--vp8/common/threading.h15
1 files changed, 9 insertions, 6 deletions
diff --git a/vp8/common/threading.h b/vp8/common/threading.h
index f92136938..1cfb9fec5 100644
--- a/vp8/common/threading.h
+++ b/vp8/common/threading.h
@@ -171,17 +171,20 @@ static inline int sem_destroy(sem_t *sem) {
#define sem_wait(sem) (semaphore_wait(*sem))
#define sem_post(sem) semaphore_signal(*sem)
#define sem_destroy(sem) semaphore_destroy(mach_task_self(), *sem)
-#define thread_sleep(nms)
-/* { struct timespec ts;ts.tv_sec=0; ts.tv_nsec =
- 1000*nms;nanosleep(&ts, NULL);} */
#else
#include <unistd.h>
#include <sched.h>
-#define thread_sleep(nms) sched_yield();
+#endif /* __APPLE__ */
+/* Not Windows. Assume pthreads */
+
+/* thread_sleep implementation: yield unless Linux/Unix. */
+#if defined(__unix__) || defined(__APPLE__)
+#define thread_sleep(nms)
/* {struct timespec ts;ts.tv_sec=0;
ts.tv_nsec = 1000*nms;nanosleep(&ts, NULL);} */
-#endif
-/* Not Windows. Assume pthreads */
+#else
+#define thread_sleep(nms) sched_yield();
+#endif /* __unix__ || __APPLE__ */
#endif