提交 5e323ee9 authored 作者: Anthony Minessale's avatar Anthony Minessale

newest version of sleep patch

上级 ea463a61
...@@ -171,15 +171,11 @@ static inline int sem_destroy(sem_t *sem) { ...@@ -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 */
......
...@@ -361,7 +361,7 @@ static void mt_decode_mb_rows(VP8D_COMP *pbi, MACROBLOCKD *xd, ...@@ -361,7 +361,7 @@ static void mt_decode_mb_rows(VP8D_COMP *pbi, MACROBLOCKD *xd,
if ((mb_col & (nsync - 1)) == 0) { if ((mb_col & (nsync - 1)) == 0) {
while (mb_col > (*last_row_current_mb_col - nsync)) { while (mb_col > (*last_row_current_mb_col - nsync)) {
x86_pause_hint(); x86_pause_hint();
thread_sleep(0); thread_sleep(1);
} }
} }
......
...@@ -424,7 +424,7 @@ static void encode_mb_row(VP8_COMP *cpi, VP8_COMMON *cm, int mb_row, ...@@ -424,7 +424,7 @@ static void encode_mb_row(VP8_COMP *cpi, VP8_COMMON *cm, int mb_row,
if ((mb_col & (nsync - 1)) == 0) { if ((mb_col & (nsync - 1)) == 0) {
while (mb_col > (*last_row_current_mb_col - nsync)) { while (mb_col > (*last_row_current_mb_col - nsync)) {
x86_pause_hint(); x86_pause_hint();
thread_sleep(0); thread_sleep(1);
} }
} }
} }
......
...@@ -108,7 +108,7 @@ static THREAD_FUNCTION thread_encoding_proc(void *p_data) { ...@@ -108,7 +108,7 @@ static THREAD_FUNCTION thread_encoding_proc(void *p_data) {
if ((mb_col & (nsync - 1)) == 0) { if ((mb_col & (nsync - 1)) == 0) {
while (mb_col > (*last_row_current_mb_col - nsync)) { while (mb_col > (*last_row_current_mb_col - nsync)) {
x86_pause_hint(); x86_pause_hint();
thread_sleep(0); thread_sleep(1);
} }
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论