diff options
author | wm4 <wm4@nowhere> | 2015-05-11 23:44:36 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-05-11 23:44:36 +0200 |
commit | 92b9d75d7256be71d8c8b18438af9494b78f0e96 (patch) | |
tree | eaf114423ce898dc5ac77f5fa48c3f13ef699c41 /stream | |
parent | ca9964a4fb6b1faa0155da43b3c815db0075e2d5 (diff) | |
download | mpv-92b9d75d7256be71d8c8b18438af9494b78f0e96.tar.bz2 mpv-92b9d75d7256be71d8c8b18438af9494b78f0e96.tar.xz |
threads: use utility+POSIX functions instead of weird wrappers
There is not much of a reason to have these wrappers around. Use POSIX
standard functions directly, and use a separate utility function to take
care of the timespec calculations. (Course POSIX for using this weird
format for time values.)
Diffstat (limited to 'stream')
-rw-r--r-- | stream/cache.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/stream/cache.c b/stream/cache.c index 0ffa3927be..ede1e1fe83 100644 --- a/stream/cache.c +++ b/stream/cache.c @@ -134,7 +134,8 @@ static void cache_wakeup_and_wait(struct priv *s, double *retry_time) } pthread_cond_signal(&s->wakeup); - mpthread_cond_timedwait_rel(&s->wakeup, &s->mutex, CACHE_WAIT_TIME); + struct timespec ts = mp_rel_time_to_timespec(CACHE_WAIT_TIME); + pthread_cond_timedwait(&s->wakeup, &s->mutex, &ts); if (*retry_time >= 0) *retry_time += mp_time_sec() - start; @@ -465,8 +466,10 @@ static void *cache_thread(void *arg) pthread_cond_signal(&s->wakeup); s->control = CACHE_CTRL_NONE; } - if (s->idle && s->control == CACHE_CTRL_NONE) - mpthread_cond_timedwait_rel(&s->wakeup, &s->mutex, CACHE_IDLE_SLEEP_TIME); + if (s->idle && s->control == CACHE_CTRL_NONE) { + struct timespec ts = mp_rel_time_to_timespec(CACHE_IDLE_SLEEP_TIME); + pthread_cond_timedwait(&s->wakeup, &s->mutex, &ts); + } } pthread_cond_signal(&s->wakeup); pthread_mutex_unlock(&s->mutex); |