1*433d6423SLionel Sambuc #include "timers.h" 2*433d6423SLionel Sambuc 3*433d6423SLionel Sambuc /*===========================================================================* 4*433d6423SLionel Sambuc * tmrs_clrtimer * 5*433d6423SLionel Sambuc *===========================================================================*/ 6*433d6423SLionel Sambuc clock_t tmrs_clrtimer(tmrs, tp, next_time) 7*433d6423SLionel Sambuc minix_timer_t **tmrs; /* pointer to timers queue */ 8*433d6423SLionel Sambuc minix_timer_t *tp; /* timer to be removed */ 9*433d6423SLionel Sambuc clock_t *next_time; 10*433d6423SLionel Sambuc { 11*433d6423SLionel Sambuc /* Deactivate a timer and remove it from the timers queue. 12*433d6423SLionel Sambuc */ 13*433d6423SLionel Sambuc minix_timer_t **atp; 14*433d6423SLionel Sambuc clock_t prev_time; 15*433d6423SLionel Sambuc 16*433d6423SLionel Sambuc if(*tmrs) 17*433d6423SLionel Sambuc prev_time = (*tmrs)->tmr_exp_time; 18*433d6423SLionel Sambuc else 19*433d6423SLionel Sambuc prev_time = 0; 20*433d6423SLionel Sambuc 21*433d6423SLionel Sambuc tp->tmr_exp_time = TMR_NEVER; 22*433d6423SLionel Sambuc 23*433d6423SLionel Sambuc for (atp = tmrs; *atp != NULL; atp = &(*atp)->tmr_next) { 24*433d6423SLionel Sambuc if (*atp == tp) { 25*433d6423SLionel Sambuc *atp = tp->tmr_next; 26*433d6423SLionel Sambuc break; 27*433d6423SLionel Sambuc } 28*433d6423SLionel Sambuc } 29*433d6423SLionel Sambuc 30*433d6423SLionel Sambuc if(next_time) { 31*433d6423SLionel Sambuc if(*tmrs) 32*433d6423SLionel Sambuc *next_time = (*tmrs)->tmr_exp_time; 33*433d6423SLionel Sambuc else 34*433d6423SLionel Sambuc *next_time = 0; 35*433d6423SLionel Sambuc } 36*433d6423SLionel Sambuc 37*433d6423SLionel Sambuc return prev_time; 38*433d6423SLionel Sambuc } 39*433d6423SLionel Sambuc 40