From 5e323ee97acb5b5bea447b604c4936ce37ae239a Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 26 Sep 2016 14:09:55 -0500 Subject: [PATCH] newest version of sleep patch --- libs/libvpx/vp8/common/threading.h | 8 ++------ libs/libvpx/vp8/decoder/threading.c | 2 +- libs/libvpx/vp8/encoder/encodeframe.c | 2 +- libs/libvpx/vp8/encoder/ethreading.c | 2 +- 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/libs/libvpx/vp8/common/threading.h b/libs/libvpx/vp8/common/threading.h index f27b209c40..c829fbc279 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 */ diff --git a/libs/libvpx/vp8/decoder/threading.c b/libs/libvpx/vp8/decoder/threading.c index 44ca16bfdd..88f7723e33 100644 --- a/libs/libvpx/vp8/decoder/threading.c +++ b/libs/libvpx/vp8/decoder/threading.c @@ -361,7 +361,7 @@ static void mt_decode_mb_rows(VP8D_COMP *pbi, MACROBLOCKD *xd, if ((mb_col & (nsync - 1)) == 0) { while (mb_col > (*last_row_current_mb_col - nsync)) { x86_pause_hint(); - thread_sleep(0); + thread_sleep(1); } } diff --git a/libs/libvpx/vp8/encoder/encodeframe.c b/libs/libvpx/vp8/encoder/encodeframe.c index e41d513c1b..600ba4061b 100644 --- a/libs/libvpx/vp8/encoder/encodeframe.c +++ b/libs/libvpx/vp8/encoder/encodeframe.c @@ -424,7 +424,7 @@ static void encode_mb_row(VP8_COMP *cpi, VP8_COMMON *cm, int mb_row, if ((mb_col & (nsync - 1)) == 0) { while (mb_col > (*last_row_current_mb_col - nsync)) { x86_pause_hint(); - thread_sleep(0); + thread_sleep(1); } } } diff --git a/libs/libvpx/vp8/encoder/ethreading.c b/libs/libvpx/vp8/encoder/ethreading.c index 708002b1e6..68ca0df08d 100644 --- a/libs/libvpx/vp8/encoder/ethreading.c +++ b/libs/libvpx/vp8/encoder/ethreading.c @@ -108,7 +108,7 @@ static THREAD_FUNCTION thread_encoding_proc(void *p_data) { if ((mb_col & (nsync - 1)) == 0) { while (mb_col > (*last_row_current_mb_col - nsync)) { x86_pause_hint(); - thread_sleep(0); + thread_sleep(1); } }