mirror of https://github.com/mpv-player/mpv
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.
This commit is contained in:
parent
2f7cef117a
commit
f5df78b3fc
|
@ -238,9 +238,11 @@ void mp_dispatch_suspend(struct mp_dispatch_queue *queue)
|
||||||
void mp_dispatch_resume(struct mp_dispatch_queue *queue)
|
void mp_dispatch_resume(struct mp_dispatch_queue *queue)
|
||||||
{
|
{
|
||||||
pthread_mutex_lock(&queue->lock);
|
pthread_mutex_lock(&queue->lock);
|
||||||
|
assert(queue->suspended);
|
||||||
assert(queue->suspend_requested > 0);
|
assert(queue->suspend_requested > 0);
|
||||||
queue->suspend_requested--;
|
queue->suspend_requested--;
|
||||||
pthread_cond_broadcast(&queue->cond);
|
if (queue->suspend_requested == 0)
|
||||||
|
pthread_cond_broadcast(&queue->cond);
|
||||||
pthread_mutex_unlock(&queue->lock);
|
pthread_mutex_unlock(&queue->lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue