From f5df78b3fc1dac42fcf19b1ead4ba984c57ce4e1 Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 24 Apr 2014 01:03:05 +0200 Subject: 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. --- misc/dispatch.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'misc') 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); } -- cgit v1.2.3