1 #include <minix/timers.h>
4 * Activate a timer to run function 'watchdog' at absolute time 'exp_time', as
5 * part of timers queue 'tmrs'. If the timer is already in use, it is first
6 * removed from the timers queue. Then, it is put in the list of active timers
7 * with the first to expire in front. The caller responsible for scheduling a
8 * new alarm for the timer if needed. To that end, the function returns three
9 * values: its return value (TRUE or FALSE) indicates whether there was an old
10 * head timer; if TRUE, 'old_head' (if non-NULL) is filled with the absolute
11 * expiry time of the old head timer. If 'new_head' is non-NULL, it is filled
12 * with the absolute expiry time of the new head timer.
15 tmrs_settimer(minix_timer_t
** tmrs
, minix_timer_t
* tp
, clock_t exp_time
,
16 tmr_func_t watchdog
, int arg
, clock_t * old_head
, clock_t * new_head
)
23 *old_head
= (*tmrs
)->tmr_exp_time
;
28 /* Set the timer's variables. */
30 (void)tmrs_clrtimer(tmrs
, tp
, NULL
, NULL
);
31 tp
->tmr_exp_time
= exp_time
;
32 tp
->tmr_func
= watchdog
; /* set the timer object */
36 * Add the timer to the active timers. The next timer due is in front.
38 for (atp
= tmrs
; *atp
!= NULL
; atp
= &(*atp
)->tmr_next
) {
39 if (tmr_is_first(exp_time
, (*atp
)->tmr_exp_time
))
46 *new_head
= (*tmrs
)->tmr_exp_time
;