summaryrefslogtreecommitdiffstats
path: root/misc
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-04-24 01:03:05 +0200
committerwm4 <wm4@nowhere>2014-04-24 01:03:05 +0200
commitf5df78b3fc1dac42fcf19b1ead4ba984c57ce4e1 (patch)
tree0c79132c76d7a559bc18bd1d9e8ac9986d3e5ca6 /misc
parent2f7cef117a04f39f11ced002da678cee8ab08079 (diff)
downloadmpv-f5df78b3fc1dac42fcf19b1ead4ba984c57ce4e1.tar.bz2
mpv-f5df78b3fc1dac42fcf19b1ead4ba984c57ce4e1.tar.xz
dispatch: wakeup only if needed on mp_dispatch_resume()
The wakeup is needed to make mp_dispatch_queue_process() return if suspension is not needed anymore - which is only the case when the request count reaches 0. The assertion added with this commit always has/had to be true.
Diffstat (limited to 'misc')
-rw-r--r--misc/dispatch.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/misc/dispatch.c b/misc/dispatch.c
index aca25ff86b..59b3dbc98a 100644
--- a/misc/dispatch.c
+++ b/misc/dispatch.c
@@ -238,9 +238,11 @@ void mp_dispatch_suspend(struct mp_dispatch_queue *queue)
void mp_dispatch_resume(struct mp_dispatch_queue *queue)
{
pthread_mutex_lock(&queue->lock);
+ assert(queue->suspended);
assert(queue->suspend_requested > 0);
queue->suspend_requested--;
- pthread_cond_broadcast(&queue->cond);
+ if (queue->suspend_requested == 0)
+ pthread_cond_broadcast(&queue->cond);
pthread_mutex_unlock(&queue->lock);
}