new version of vp8 thread sleep patch

This commit is contained in:
Anthony Minessale 2019-01-17 20:21:29 +00:00 committed by Andrey Volk
parent 731ee28fe7
commit e7dd41e361
1 changed files with 3 additions and 7 deletions

View File

@ -171,15 +171,11 @@ static inline int sem_destroy(sem_t *sem) {
#define sem_wait(sem) (semaphore_wait(*sem)) #define sem_wait(sem) (semaphore_wait(*sem))
#define sem_post(sem) semaphore_signal(*sem) #define sem_post(sem) semaphore_signal(*sem)
#define sem_destroy(sem) semaphore_destroy(mach_task_self(), *sem) #define sem_destroy(sem) semaphore_destroy(mach_task_self(), *sem)
#define thread_sleep(nms) #define thread_sleep(nms) { struct timespec ts;ts.tv_sec=0; ts.tv_nsec = 1000*nms;nanosleep(&ts, NULL);}
/* { struct timespec ts;ts.tv_sec=0; ts.tv_nsec =
1000*nms;nanosleep(&ts, NULL);} */
#else #else
#include <unistd.h> #include <unistd.h>
#include <sched.h> #include <sched.h>
#define thread_sleep(nms) sched_yield(); #define thread_sleep(nms) {struct timespec ts;ts.tv_sec=0; ts.tv_nsec = 1000*nms;nanosleep(&ts, NULL);}
/* {struct timespec ts;ts.tv_sec=0;
ts.tv_nsec = 1000*nms;nanosleep(&ts, NULL);} */
#endif #endif
/* Not Windows. Assume pthreads */ /* Not Windows. Assume pthreads */
@ -199,7 +195,7 @@ static INLINE void vp8_atomic_spin_wait(
const int nsync) { const int nsync) {
while (mb_col > (vpx_atomic_load_acquire(last_row_current_mb_col) - nsync)) { while (mb_col > (vpx_atomic_load_acquire(last_row_current_mb_col) - nsync)) {
x86_pause_hint(); x86_pause_hint();
thread_sleep(0); thread_sleep(1);
} }
} }