kernel: scheduling fix for ARM
[minix.git] / lib / libtimers / tmrs_clr.c
blob5b97570b3f614156992fef23e5cd032cee5b290e
1 #include "timers.h"
3 /*===========================================================================*
4 * tmrs_clrtimer *
5 *===========================================================================*/
6 clock_t tmrs_clrtimer(tmrs, tp, next_time)
7 timer_t **tmrs; /* pointer to timers queue */
8 timer_t *tp; /* timer to be removed */
9 clock_t *next_time;
11 /* Deactivate a timer and remove it from the timers queue.
13 timer_t **atp;
14 clock_t prev_time;
16 if(*tmrs)
17 prev_time = (*tmrs)->tmr_exp_time;
18 else
19 prev_time = 0;
21 tp->tmr_exp_time = TMR_NEVER;
23 for (atp = tmrs; *atp != NULL; atp = &(*atp)->tmr_next) {
24 if (*atp == tp) {
25 *atp = tp->tmr_next;
26 break;
30 if(next_time) {
31 if(*tmrs)
32 *next_time = (*tmrs)->tmr_exp_time;
33 else
34 *next_time = 0;
37 return prev_time;