From 2eb36c00c11f1e7025f7945a6fc8ee4cedafaec9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barnab=C3=A1s=20P=C5=91cze?= Date: Sat, 19 Feb 2022 11:44:04 +0100 Subject: [PATCH] spa: support: loop: add `polling` flag Store whether or not the loop is currently polling, i.e. calling `spa_system_pollfd_wait()`. --- spa/plugins/support/loop.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/spa/plugins/support/loop.c b/spa/plugins/support/loop.c index 611adc21b..693495cc6 100644 --- a/spa/plugins/support/loop.c +++ b/spa/plugins/support/loop.c @@ -90,6 +90,7 @@ struct impl { uint8_t buffer_mem[DATAS_SIZE + MAX_ALIGN]; unsigned int flushing:1; + unsigned int polling:1; }; struct source_impl { @@ -350,11 +351,13 @@ static int loop_iterate(void *object, int timeout) struct spa_poll_event ep[MAX_EP], *e; int i, nfds; + impl->polling = true; spa_loop_control_hook_before(&impl->hooks_list); nfds = spa_system_pollfd_wait(impl->system, impl->poll_fd, ep, SPA_N_ELEMENTS(ep), timeout); spa_loop_control_hook_after(&impl->hooks_list); + impl->polling = false; /* first we set all the rmasks, then call the callbacks. The reason is that * some callback might also want to look at other sources it manages and