timers.h 845 B

123456789101112131415161718192021222324252627282930
  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. void timers_initialize(void);
  19. void timers_shutdown(void);
  20. #ifdef TOR_TIMERS_PRIVATE
  21. STATIC void timers_run_pending(void);
  22. #endif
  23. #endif