mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-11-17 23:08:35 +00:00
[libvpx] Fix threading.
This commit is contained in:
1 parent
0b3e4644f2
commit
2baece4a5e
1 file changed
+5
-5
@@ -74,12 +74,12 @@ static INLINE int vp8_sem_wait(vp8_sem_t *sem) {
|
|||||||
/* Not Windows. Assume pthreads */
|
/* Not Windows. Assume pthreads */
|
||||||
|
|
||||||
/* thread_sleep implementation: yield unless Linux/Unix. */
|
/* thread_sleep implementation: yield unless Linux/Unix. */
|
||||||
|
#include <sched.h>
|
||||||
|
#include <time.h>
|
||||||
#if defined(__unix__) || defined(__APPLE__)
|
#if defined(__unix__) || defined(__APPLE__)
|
||||||
#define thread_sleep(nms)
|
#define thread_sleep(nms) { struct timespec ts;ts.tv_sec=0; ts.tv_nsec = 1000*nms;sched_yield();nanosleep(&ts, NULL);}
|
||||||
/* {struct timespec ts;ts.tv_sec=0;
|
|
||||||
ts.tv_nsec = 1000*nms;nanosleep(&ts, NULL);} */
|
|
||||||
#else
|
#else
|
||||||
#define thread_sleep(nms) sched_yield();
|
#define thread_sleep(nms) {struct timespec ts;ts.tv_sec=0; ts.tv_nsec = 1000*nms;sched_yield();clock_nanosleep(CLOCK_MONOTONIC, 0, &ts, NULL);}
|
||||||
#endif /* __unix__ || __APPLE__ */
|
#endif /* __unix__ || __APPLE__ */
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -97,7 +97,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(1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user