summaryrefslogtreecommitdiffstats
path: root/stream
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-05-18 16:36:08 +0200
committerwm4 <wm4@nowhere>2014-05-18 19:20:32 +0200
commitf47a4fc3d900e14653bc059717e2805ad4964a67 (patch)
treea8ca8944a10c15bbb46239db62a56940a0d3f7b1 /stream
parente209e44ca2fef86ec2ec5513bbb63d4d68ff97b5 (diff)
downloadmpv-f47a4fc3d900e14653bc059717e2805ad4964a67.tar.bz2
mpv-f47a4fc3d900e14653bc059717e2805ad4964a67.tar.xz
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.
Diffstat (limited to 'stream')
-rw-r--r--stream/cache.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/stream/cache.c b/stream/cache.c
index f0d132ad64..6079f6b976 100644
--- a/stream/cache.c
+++ b/stream/cache.c
@@ -167,7 +167,7 @@ static int cache_wakeup_and_wait(struct priv *s, double *retry_time)
}
pthread_cond_signal(&s->wakeup);
- mpthread_cond_timedwait(&s->wakeup, &s->mutex, CACHE_WAIT_TIME);
+ mpthread_cond_timedwait_rel(&s->wakeup, &s->mutex, CACHE_WAIT_TIME);
*retry_time += mp_time_sec() - start;
@@ -529,7 +529,7 @@ static void *cache_thread(void *arg)
s->control = CACHE_CTRL_NONE;
}
if (s->idle && s->control == CACHE_CTRL_NONE)
- mpthread_cond_timedwait(&s->wakeup, &s->mutex, CACHE_IDLE_SLEEP_TIME);
+ mpthread_cond_timedwait_rel(&s->wakeup, &s->mutex, CACHE_IDLE_SLEEP_TIME);
}
pthread_cond_signal(&s->wakeup);
pthread_mutex_unlock(&s->mutex);