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
|
|
|
|
2022-01-08 14:27:29 +01: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 05:57:05 +02:00
|
|
|
/* Get timer arg. */
|
2022-01-08 14:27:29 +01:00
|
|
|
void *oneshot_arg(struct oneshot *t);
|
2021-10-07 05:57:05 +02:00
|
|
|
|
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 */
|