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