timer.h 788 B

12345678910111213141516171819202122232425262728293031323334
  1. /*
  2. * timer.h
  3. *
  4. * Deadline-based timer callbacks.
  5. *
  6. * Written & released by Keir Fraser <keir.xen@gmail.com>
  7. *
  8. * This is free and unencumbered software released into the public domain.
  9. * See the file COPYING for more details, or visit <http://unlicense.org>.
  10. */
  11. struct timer {
  12. time_t deadline;
  13. void (*cb_fn)(void *);
  14. void *cb_dat;
  15. struct timer *next;
  16. };
  17. /* Safe to call from any priority level same or lower than TIMER_IRQ_PRI. */
  18. void timer_init(struct timer *timer, void (*cb_fn)(void *), void *cb_dat);
  19. void timer_set(struct timer *timer, time_t deadline);
  20. void timer_cancel(struct timer *timer);
  21. void timers_init(void);
  22. /*
  23. * Local variables:
  24. * mode: C
  25. * c-file-style: "Linux"
  26. * c-basic-offset: 4
  27. * tab-width: 4
  28. * indent-tabs-mode: nil
  29. * End:
  30. */