From 92b9d75d7256be71d8c8b18438af9494b78f0e96 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 11 May 2015 23:44:36 +0200 Subject: 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.) --- audio/out/push.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'audio/out') diff --git a/audio/out/push.c b/audio/out/push.c index 8e3d2f87b0..beafd36a13 100644 --- a/audio/out/push.c +++ b/audio/out/push.c @@ -340,7 +340,8 @@ static void *playthread(void *arg) pthread_cond_signal(&p->wakeup); // for draining if (p->still_playing && timeout > 0) { - mpthread_cond_timedwait_rel(&p->wakeup, &p->lock, timeout); + struct timespec ts = mp_rel_time_to_timespec(timeout); + pthread_cond_timedwait(&p->wakeup, &p->lock, &ts); } else { pthread_cond_wait(&p->wakeup, &p->lock); } @@ -352,8 +353,10 @@ static void *playthread(void *arg) if (ao->driver->get_delay) timeout = ao->driver->get_delay(ao); timeout *= 0.25; // wake up if 25% played - if (!p->need_wakeup) - mpthread_cond_timedwait_rel(&p->wakeup, &p->lock, timeout); + if (!p->need_wakeup) { + struct timespec ts = mp_rel_time_to_timespec(timeout); + pthread_cond_timedwait(&p->wakeup, &p->lock, &ts); + } } } MP_STATS(ao, "end audio wait"); -- cgit v1.2.3