From f47a4fc3d900e14653bc059717e2805ad4964a67 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 18 May 2014 16:36:08 +0200 Subject: threads: use mpv time for mpthread_cond_timedwait wrapper Use the time as returned by mp_time_us() for mpthread_cond_timedwait(), instead of calculating the struct timespec value based on a timeout. This (probably) makes it easier to wait for a specific deadline. --- player/client.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'player/client.c') diff --git a/player/client.c b/player/client.c index a867681d34..88ebabafaa 100644 --- a/player/client.c +++ b/player/client.c @@ -477,7 +477,7 @@ mpv_event *mpv_wait_event(mpv_handle *ctx, double timeout) { mpv_event *event = ctx->cur_event; - struct timespec deadline = mpthread_get_deadline(timeout); + int64_t deadline = mp_add_timeout(mp_time_us(), timeout); pthread_mutex_lock(&ctx->lock); @@ -519,7 +519,7 @@ mpv_event *mpv_wait_event(mpv_handle *ctx, double timeout) break; if (timeout <= 0) break; - int r = pthread_cond_timedwait(&ctx->wakeup, &ctx->lock, &deadline); + int r = mpthread_cond_timedwait(&ctx->wakeup, &ctx->lock, deadline); if (r == ETIMEDOUT) break; } -- cgit v1.2.3