1 /* Copyright (c) 2016-2021, The Tor Project, Inc. */
2 /* See LICENSE for licensing information */
6 * \brief Header for timers.c
13 #include "lib/testsupport/testsupport.h"
17 typedef struct timeout tor_timer_t
;
18 typedef void (*timer_cb_fn_t
)(tor_timer_t
*, void *,
19 const struct monotime_t
*);
20 tor_timer_t
*timer_new(timer_cb_fn_t cb
, void *arg
);
21 void timer_set_cb(tor_timer_t
*t
, timer_cb_fn_t cb
, void *arg
);
22 void timer_get_cb(const tor_timer_t
*t
,
23 timer_cb_fn_t
*cb_out
, void **arg_out
);
24 void timer_schedule(tor_timer_t
*t
, const struct timeval
*delay
);
25 void timer_disable(tor_timer_t
*t
);
26 void timer_free_(tor_timer_t
*t
);
27 #define timer_free(t) FREE_AND_NULL(tor_timer_t, timer_free_, (t))
29 void timers_initialize(void);
30 void timers_shutdown(void);
32 #ifdef TOR_TIMERS_PRIVATE
33 STATIC
void timers_run_pending(void);
36 #endif /* !defined(TOR_TIMERS_H) */