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.
This commit is contained in:
Barnabás Pőcze 2022-02-19 09:42:49 +01:00 committed by Wim Taymans
parent a22ce76dbf
commit cb8c2d8857

View file

@ -367,10 +367,15 @@ static int loop_iterate(void *object, int timeout)
} }
for (i = 0; i < nfds; i++) { for (i = 0; i < nfds; i++) {
struct spa_source *s = ep[i].data; struct spa_source *s = ep[i].data;
if (SPA_LIKELY(s && s->rmask && s->loop)) { if (SPA_LIKELY(s && s->rmask && s->loop))
s->priv = NULL;
s->func(s); 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))) if (SPA_UNLIKELY(!spa_list_is_empty(&impl->destroy_list)))
process_destroy(impl); process_destroy(impl);