From 25fbcae1b350aaea5b0a3c79da8e835a26f07d24 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 30 Jul 2024 12:04:42 +0200 Subject: [PATCH] loop: release queue lock before calling invoke function We don't actually need to hold the lock while calling the invoke function, we only need the lock to protect the list of queues. --- spa/plugins/support/loop.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/spa/plugins/support/loop.c b/spa/plugins/support/loop.c index c9ca20025..694700bd2 100644 --- a/spa/plugins/support/loop.c +++ b/spa/plugins/support/loop.c @@ -212,9 +212,12 @@ static void flush_all_queues(struct impl *impl) * read index before we call the function because then the item * might get overwritten. */ func = spa_steal_ptr(item->func); - if (func) + if (func) { + pthread_mutex_unlock(&impl->queue_lock); item->res = func(&impl->loop, true, item->seq, item->data, item->size, item->user_data); + pthread_mutex_lock(&impl->queue_lock); + } /* if this function did a recursive invoke, it now flushed the * ringbuffer and we can exit */