Lines Matching refs:te
200 struct timer_entry *te, *te2; in tmr_run() local
202 te = TAILQ_FIRST(&tmrs->head); in tmr_run()
203 if (te == NULL) in tmr_run()
206 te->timeout -= tmrs->res; in tmr_run()
207 while (te->timeout <= 0) { in tmr_run()
208 te2 = TAILQ_NEXT(te, next); in tmr_run()
209 TAILQ_REMOVE(&tmrs->head, te, next); in tmr_run()
210 te->func(te->id, te->arg); in tmr_run()
211 free(te); in tmr_run()
212 te = te2; in tmr_run()
213 if (te == NULL) in tmr_run()
222 struct timer_entry *te, *te2, *te3; in tmr_add() local
224 te = malloc(sizeof(struct timer_entry)); in tmr_add()
225 memset(te, 0, sizeof(struct timer_entry)); in tmr_add()
227 te->timeout = timeout; in tmr_add()
228 te->func = func; in tmr_add()
229 te->arg = arg; in tmr_add()
230 te->id = id; in tmr_add()
235 TAILQ_INSERT_HEAD(&tmrs->head, te, next); in tmr_add()
236 } else if (te->timeout < te2->timeout) { in tmr_add()
237 te2->timeout -= te->timeout; in tmr_add()
238 TAILQ_INSERT_HEAD(&tmrs->head, te, next); in tmr_add()
240 while (te->timeout >= te2->timeout) { in tmr_add()
241 te->timeout -= te2->timeout; in tmr_add()
243 if (te3 == NULL || te3->timeout > te->timeout) in tmr_add()
247 TAILQ_INSERT_AFTER(&tmrs->head, te2, te, next); in tmr_add()