minix/lib/libtimers/tmrs_exp.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

32 lines
851 B
C

#include "timers.h"
/*===========================================================================*
* tmrs_exptimers *
*===========================================================================*/
void tmrs_exptimers(tmrs, now, new_head)
minix_timer_t **tmrs; /* pointer to timers queue */
clock_t now; /* current time */
clock_t *new_head;
{
/* Use the current time to check the timers queue list for expired timers.
* Run the watchdog functions for all expired timers and deactivate them.
* The caller is responsible for scheduling a new alarm if needed.
*/
minix_timer_t *tp;
while ((tp = *tmrs) != NULL && tp->tmr_exp_time <= now) {
*tmrs = tp->tmr_next;
tp->tmr_exp_time = TMR_NEVER;
(*tp->tmr_func)(tp);
}
if(new_head) {
if(*tmrs)
*new_head = (*tmrs)->tmr_exp_time;
else
*new_head = 0;
}
}