timers.h 942 B

12345678910111213141516171819202122232425262728293031
  1. /* Copyright (c) 2016-2017, The Tor Project, Inc. */
  2. /* See LICENSE for licensing information */
  3. #ifndef TOR_TIMERS_H
  4. #define TOR_TIMERS_H
  5. #include "orconfig.h"
  6. #include "testsupport.h"
  7. struct monotime_t;
  8. typedef struct timeout tor_timer_t;
  9. typedef void (*timer_cb_fn_t)(tor_timer_t *, void *,
  10. const struct monotime_t *);
  11. tor_timer_t *timer_new(timer_cb_fn_t cb, void *arg);
  12. void timer_set_cb(tor_timer_t *t, timer_cb_fn_t cb, void *arg);
  13. void timer_get_cb(const tor_timer_t *t,
  14. timer_cb_fn_t *cb_out, void **arg_out);
  15. void timer_schedule(tor_timer_t *t, const struct timeval *delay);
  16. void timer_disable(tor_timer_t *t);
  17. void timer_free_(tor_timer_t *t);
  18. #define timer_free(t) FREE_AND_NULL(tor_timer_t, timer_free_, (t))
  19. void timers_initialize(void);
  20. void timers_shutdown(void);
  21. #ifdef TOR_TIMERS_PRIVATE
  22. STATIC void timers_run_pending(void);
  23. #endif
  24. #endif /* !defined(TOR_TIMERS_H) */