minix/lib/libtimers/tmrs_clr.c
Lionel Sambuc 9fab85c2de Replacing timer_t by netbsd's timer_t
* Renamed struct timer to struct minix_timer
 * Renamed timer_t to minix_timer_t
 * Ensured all the code uses the minix_timer_t typedef
 * Removed ifdef around _BSD_TIMER_T
 * Removed include/timers.h and merged it into include/minix/timers.h
 * Resolved prototype conflict by renaming kernel's (re)set_timer
   to (re)set_kernel_timer.

Change-Id: I56f0f30dfed96e1a0575d92492294cf9a06468a5
2014-03-01 09:04:54 +01:00

40 lines
843 B
C

#include "timers.h"
/*===========================================================================*
* tmrs_clrtimer *
*===========================================================================*/
clock_t tmrs_clrtimer(tmrs, tp, next_time)
minix_timer_t **tmrs; /* pointer to timers queue */
minix_timer_t *tp; /* timer to be removed */
clock_t *next_time;
{
/* Deactivate a timer and remove it from the timers queue.
*/
minix_timer_t **atp;
clock_t prev_time;
if(*tmrs)
prev_time = (*tmrs)->tmr_exp_time;
else
prev_time = 0;
tp->tmr_exp_time = TMR_NEVER;
for (atp = tmrs; *atp != NULL; atp = &(*atp)->tmr_next) {
if (*atp == tp) {
*atp = tp->tmr_next;
break;
}
}
if(next_time) {
if(*tmrs)
*next_time = (*tmrs)->tmr_exp_time;
else
*next_time = 0;
}
return prev_time;
}