2005-04-21 16:53:53 +02:00
|
|
|
#include "timers.h"
|
|
|
|
|
|
|
|
/*===========================================================================*
|
|
|
|
* tmrs_exptimers *
|
|
|
|
*===========================================================================*/
|
2005-06-17 15:47:29 +02:00
|
|
|
void tmrs_exptimers(tmrs, now, new_head)
|
2005-04-21 16:53:53 +02:00
|
|
|
timer_t **tmrs; /* pointer to timers queue */
|
|
|
|
clock_t now; /* current time */
|
2005-06-17 15:47:29 +02:00
|
|
|
clock_t *new_head;
|
2005-04-21 16:53:53 +02:00
|
|
|
{
|
|
|
|
/* 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.
|
|
|
|
*/
|
|
|
|
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);
|
|
|
|
}
|
2005-06-17 15:47:29 +02:00
|
|
|
|
|
|
|
if(new_head) {
|
|
|
|
if(*tmrs)
|
|
|
|
*new_head = (*tmrs)->tmr_exp_time;
|
|
|
|
else
|
|
|
|
*new_head = 0;
|
|
|
|
}
|
2005-04-21 16:53:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|