FreeBSD/usr.sbin/uhsoctl/uhsoctl.c
/* Periodic timer, runs ready timer tasks every tick */
Periodic timer, runs ready timer tasks every tick
Periodic timer runs ready timer tasks every tick
static void
tmr_run(struct timers *tmrs)
{
	struct timer_entry *te, *te2;
	te = TAILQ_FIRST(&tmrs->head);
	if (te == NULL)
		return;
	te->timeout -= tmrs->res;
	while (te->timeout <= 0) {
		te2 = TAILQ_NEXT(te, next);
		TAILQ_REMOVE(&tmrs->head, te, next);
		te->func(te->id, te->arg);
		free(te);
		te = te2;
		if (te == NULL)
			break;
	}
}
static void tmr_run ( struct timers * tmrs ) { struct timer_entry * te , * te2 ; te = TAILQ_FIRST ( & tmrs -> head ) ; if ( te == NULL ) return ; te -> timeout -= tmrs -> res ; while ( te -> timeout <= 0 ) { te2 = TAILQ_NEXT ( te , next ) ; TAILQ_REMOVE ( & tmrs -> head , te , next ) ; te -> func ( te -> id , te -> arg ) ; free ( te ) ; te = te2 ; if ( te == NULL ) break ; } }
Periodic timer, runs ready timer tasks every tick
Periodic timer runs ready timer tasks every tick