From cb8c2d88579402e7f80f9006ac4f7cea437e4537 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barnab=C3=A1s=20P=C5=91cze?= Date: Sat, 19 Feb 2022 09:42:49 +0100 Subject: [PATCH] spa: support: loop: reset rmask after dispatch Reset the `rmask` of the sources to zero after dispatching the callbacks. This way the sources are always as up-to-date as possible. --- spa/plugins/support/loop.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/spa/plugins/support/loop.c b/spa/plugins/support/loop.c index 93992e5a5..a58b7a830 100644 --- a/spa/plugins/support/loop.c +++ b/spa/plugins/support/loop.c @@ -367,9 +367,14 @@ static int loop_iterate(void *object, int timeout) } for (i = 0; i < nfds; i++) { struct spa_source *s = ep[i].data; - if (SPA_LIKELY(s && s->rmask && s->loop)) { - s->priv = NULL; + if (SPA_LIKELY(s && s->rmask && s->loop)) s->func(s); + } + for (i = 0; i < nfds; i++) { + struct spa_source *s = ep[i].data; + if (SPA_LIKELY(s)) { + s->rmask = 0; + s->priv = NULL; } } if (SPA_UNLIKELY(!spa_list_is_empty(&impl->destroy_list)))