summaryrefslogtreecommitdiffstats
path: root/stream
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-05-11 23:44:36 +0200
committerDiogo Franco (Kovensky) <diogomfranco@gmail.com>2015-05-15 10:30:15 +0900
commit37ad3e79dd03cecc4be3a7341fdf69f96873d2eb (patch)
treeae9e6ec463c69918c334c637901427a94013c017 /stream
parent328d0c7fc326abce5fc1783e74cdd082c87d4986 (diff)
downloadmpv-37ad3e79dd03cecc4be3a7341fdf69f96873d2eb.tar.bz2
mpv-37ad3e79dd03cecc4be3a7341fdf69f96873d2eb.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.) (cherry picked from commit 92b9d75d7256be71d8c8b18438af9494b78f0e96)
Diffstat (limited to 'stream')
-rw-r--r--stream/cache.c9
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);