2017-08-28 17:06:01 +01:00
|
|
|
#ifndef LIGHTNING_COMMON_TIMEOUT_H
|
|
|
|
#define LIGHTNING_COMMON_TIMEOUT_H
|
2016-01-21 20:11:48 +00:00
|
|
|
#include "config.h"
|
|
|
|
|
2016-04-24 11:07:13 +01:00
|
|
|
#include <ccan/tal/tal.h>
|
2016-01-21 20:11:48 +00:00
|
|
|
#include <ccan/timer/timer.h>
|
|
|
|
|
2016-05-09 21:56:09 +01:00
|
|
|
/* tal_free this to disable timer. */
|
2017-02-04 14:32:02 +00:00
|
|
|
struct oneshot *new_reltimer_(struct timers *timers,
|
2016-05-09 21:56:09 +01:00
|
|
|
const tal_t *ctx,
|
|
|
|
struct timerel expire,
|
|
|
|
void (*cb)(void *), void *arg);
|
2016-01-21 20:11:48 +00:00
|
|
|
|
2017-02-04 14:32:02 +00:00
|
|
|
#define new_reltimer(timers, ctx, relexpire, func, arg) \
|
|
|
|
new_reltimer_((timers), (ctx), (relexpire), \
|
2016-05-09 21:56:09 +01:00
|
|
|
typesafe_cb(void, void *, (func), (arg)), (arg))
|
2016-01-21 20:11:48 +00:00
|
|
|
|
2022-01-08 13:27:29 +00:00
|
|
|
struct oneshot *new_abstimer_(struct timers *timers,
|
|
|
|
const tal_t *ctx,
|
|
|
|
struct timemono expiry,
|
|
|
|
void (*cb)(void *), void *arg);
|
|
|
|
#define new_abstimer(timers, ctx, expiry, func, arg) \
|
|
|
|
new_abstimer_((timers), (ctx), (expiry), \
|
|
|
|
typesafe_cb(void, void *, (func), (arg)), (arg))
|
|
|
|
|
2021-10-07 04:57:05 +01:00
|
|
|
/* Get timer arg. */
|
2022-01-08 13:27:29 +00:00
|
|
|
void *oneshot_arg(struct oneshot *t);
|
2021-10-07 04:57:05 +01:00
|
|
|
|
2021-12-06 14:45:50 +00:00
|
|
|
void timer_expired(struct timer *timer);
|
2016-01-21 20:15:27 +00:00
|
|
|
|
2017-08-28 17:06:01 +01:00
|
|
|
#endif /* LIGHTNING_COMMON_TIMEOUT_H */
|