From 37dd951079d4898556334142b9248f79bf0f3675 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 11 Sep 2019 15:52:35 +0000 Subject: [PATCH] [libvpx] Fix threading. --- libs/libvpx/vp8/common/threading.h | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/libs/libvpx/vp8/common/threading.h b/libs/libvpx/vp8/common/threading.h index 58b9013726..7a637cdff2 100644 --- a/libs/libvpx/vp8/common/threading.h +++ b/libs/libvpx/vp8/common/threading.h @@ -171,15 +171,11 @@ 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);} */ +#define thread_sleep(nms) { struct timespec ts;ts.tv_sec=0; ts.tv_nsec = 1000*nms;nanosleep(&ts, NULL);} #else #include #include -#define thread_sleep(nms) sched_yield(); -/* {struct timespec ts;ts.tv_sec=0; - ts.tv_nsec = 1000*nms;nanosleep(&ts, NULL);} */ +#define thread_sleep(nms) {struct timespec ts;ts.tv_sec=0; ts.tv_nsec = 1000*nms;nanosleep(&ts, NULL);} #endif /* Not Windows. Assume pthreads */ @@ -199,7 +195,7 @@ static INLINE void vp8_atomic_spin_wait( const int nsync) { while (mb_col > (vpx_atomic_load_acquire(last_row_current_mb_col) - nsync)) { x86_pause_hint(); - thread_sleep(0); + thread_sleep(1); } }