tor  0.4.1.0-alpha-dev
timers.h
Go to the documentation of this file.
1 /* Copyright (c) 2016-2019, The Tor Project, Inc. */
2 /* See LICENSE for licensing information */
3 
9 #ifndef TOR_TIMERS_H
10 #define TOR_TIMERS_H
11 
12 #include "orconfig.h"
14 
15 struct monotime_t;
16 typedef struct timeout tor_timer_t;
17 typedef void (*timer_cb_fn_t)(tor_timer_t *, void *,
18  const struct monotime_t *);
19 tor_timer_t *timer_new(timer_cb_fn_t cb, void *arg);
20 void timer_set_cb(tor_timer_t *t, timer_cb_fn_t cb, void *arg);
21 void timer_get_cb(const tor_timer_t *t,
22  timer_cb_fn_t *cb_out, void **arg_out);
23 void timer_schedule(tor_timer_t *t, const struct timeval *delay);
24 void timer_disable(tor_timer_t *t);
25 void timer_free_(tor_timer_t *t);
26 #define timer_free(t) FREE_AND_NULL(tor_timer_t, timer_free_, (t))
27 
28 void timers_initialize(void);
29 void timers_shutdown(void);
30 
31 #ifdef TOR_TIMERS_PRIVATE
32 STATIC void timers_run_pending(void);
33 #endif
34 
35 #endif /* !defined(TOR_TIMERS_H) */
void timer_free_(tor_timer_t *t)
Definition: timers.c:261
tor_timer_t * timer_new(timer_cb_fn_t cb, void *arg)
Definition: timers.c:248
STATIC void timers_run_pending(void)
Definition: timers.c:171
void timers_shutdown(void)
Definition: timers.c:232
void timer_get_cb(const tor_timer_t *t, timer_cb_fn_t *cb_out, void **arg_out)
Definition: timers.c:285
void timer_set_cb(tor_timer_t *t, timer_cb_fn_t cb, void *arg)
Definition: timers.c:274
void timers_initialize(void)
Definition: timers.c:203
void timer_disable(tor_timer_t *t)
Definition: timers.c:324
void timer_schedule(tor_timer_t *t, const struct timeval *delay)
Definition: timers.c:299
Macros to implement mocking and selective exposure for the test code.