summaryrefslogtreecommitdiffstats
path: root/include/poller.h
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2016-01-12 13:50:21 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2016-01-13 15:55:23 +0100
commitefd9601e15b030317eeda1618985bac34ebfcb9a (patch)
tree68e3385e007711a0ef084079fd17a5482f8f916d /include/poller.h
parent96b115be942ed8dcc94a5230fce0eafb4ac93f2d (diff)
downloadbarebox-efd9601e15b030317eeda1618985bac34ebfcb9a.tar.gz
poller: Fix async poller
The async poller does not work as expected since it can happen that the async poller is removed from the list of pollers while we are iterating over the list. Even list_for_each_entry_safe does not help here since we may remove the next list element, but list_for_each_entry_safe only allows to remove the current list element. Rework the async poller so that it is registered with the poller framework on registration and then is only marked as active with poller_call_async(). This way we do not have to do list manipulations while running the pollers. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include/poller.h')
-rw-r--r--include/poller.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/poller.h b/include/poller.h
index cda5b57..35a2271 100644
--- a/include/poller.h
+++ b/include/poller.h
@@ -26,8 +26,12 @@ struct poller_async {
void (*fn)(void *);
void *ctx;
uint64_t end;
+ int active;
};
+int poller_async_register(struct poller_async *pa);
+int poller_async_unregister(struct poller_async *pa);
+
int poller_call_async(struct poller_async *pa, uint64_t delay_ns,
void (*fn)(void *), void *ctx);
int poller_async_cancel(struct poller_async *pa);