mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-04 06:44:24 +01:00
daemon: timeout structure for IO.
For better or worse, the ccan/timer structure is completely minimal, and designed to be wrapped inside a container structure. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
27
daemon/timeout.h
Normal file
27
daemon/timeout.h
Normal file
@@ -0,0 +1,27 @@
|
||||
#ifndef LIGHTNING_DAEMON_TIMEOUT_H
|
||||
#define LIGHTNING_DAEMON_TIMEOUT_H
|
||||
#include "config.h"
|
||||
|
||||
#include <ccan/time/time.h>
|
||||
#include <ccan/timer/timer.h>
|
||||
#include <ccan/typesafe_cb/typesafe_cb.h>
|
||||
|
||||
struct timeout {
|
||||
struct timer timer;
|
||||
struct timerel interval;
|
||||
void (*cb)(void *);
|
||||
void *arg;
|
||||
};
|
||||
|
||||
struct lightningd_state;
|
||||
|
||||
void init_timeout_(struct timeout *t, unsigned int interval,
|
||||
void (*cb)(void *), void *arg);
|
||||
|
||||
void refresh_timeout(struct lightningd_state *state, struct timeout *t);
|
||||
|
||||
#define init_timeout(t, interval, func, arg) \
|
||||
init_timeout_((t), (interval), \
|
||||
typesafe_cb(void, void *, (func), (arg)), (arg))
|
||||
|
||||
#endif /* LIGHTNING_DAEMON_TIMEOUT_H */
|
||||
Reference in New Issue
Block a user