/usr/include/libAfterBase/timer.h is in libafterimage-dev 2.2.12-11.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | #ifndef TIMER_H
#define TIMER_H
#ifdef __cplusplus
extern "C" {
#endif
/*
* To use:
* 1. call timer_handle() in event loop; use timer_delay_till_next_alarm()
* to determine how long app should wait (so the app can block with
* select())
*
* Notes:
* o this timer code is not intended to handle large numbers of timeout
* events; if large numbers of events are needed, timer should be
* rewritten to be a priority queue
* o timers may be created (with timer_new()) at any point, including
* inside a timer handler
* o example of use:
* {
* struct timeval tv;
* ...
* timer_new(1000, my_handler, NULL);
* ...
* timer_delay_till_next_alarm(&tv.tv_sec, &tv.tv_usec);
* select(..., &tv); // block until timer expires
* timer_handle(); // handle any timeout events
* ...
* }
*/
typedef struct Timer
{
struct Timer *next;
void *data;
time_t sec;
time_t usec;
void (*handler) (void *timer);
}
Timer;
void timer_new (time_t msec, void (*handler) (void *), void *data);
Bool timer_delay_till_next_alarm (time_t * sec, time_t * usec);
Bool timer_handle (void);
Bool timer_remove_by_data (void *data);
void timer_remove_all ();
Bool timer_find_by_data (void *data);
#ifdef __cplusplus
}
#endif
#endif /* TIMER_H */
|