summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2013-12-12 17:17:06 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2013-12-18 16:47:48 +0100
commit3c46c02c5423fe8799f5ebcd2a07cf995b620a48 (patch)
tree2ff6d718f4671fda7f265d6f2bafe7a8ae29bfc9 /include
parent8fc3a9382537a029f5630d15209beb2dc44d4acd (diff)
downloadbarebox-3c46c02c5423fe8799f5ebcd2a07cf995b620a48.tar.gz
barebox-3c46c02c5423fe8799f5ebcd2a07cf995b620a48.tar.xz
poller: Allow to call functions asynchronously
Sometimes execution of a function has to be delayed, for example when a backlight can only be turned on when the picture has stabilized. To help in such situations add a convenience function around the poller stuff to call a function after a delay. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include')
-rw-r--r--include/poller.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/include/poller.h b/include/poller.h
index dc981557db..cda5b5774b 100644
--- a/include/poller.h
+++ b/include/poller.h
@@ -12,13 +12,25 @@
struct poller_struct {
void (*func)(struct poller_struct *poller);
-
+ int registered;
struct list_head list;
};
int poller_register(struct poller_struct *poller);
int poller_unregister(struct poller_struct *poller);
+struct poller_async;
+
+struct poller_async {
+ struct poller_struct poller;
+ void (*fn)(void *);
+ void *ctx;
+ uint64_t end;
+};
+
+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);
#ifdef CONFIG_POLLER
void poller_call(void);