timer.h (573B)
1 /* see LICENSE file for copyright and license details */ 2 #ifndef ARUU_TIMER_H 3 #define ARUU_TIMER_H 4 5 #include <time.h> 6 7 /* one shot timers on a clock that keeps counting while the machine 8 * sleeps, waited on together with a file descriptor. a backend per kernel */ 9 #define TIMER_MAX 8 10 11 int timer_init(int n); 12 /* a zero ts disarms timer i */ 13 int timer_set(int i, const struct timespec *ts); 14 int timer_left(int i, struct timespec *ts); 15 /* 0 once fd is readable, else the mask of the timers that fired, 1 << i. 16 * -1 with errno set on error */ 17 int timer_wait(int fd); 18 19 #endif