Lines Matching refs:timeout
55 struct dl_list timeout; member
78 dl_list_init(&eloop.timeout); in eloop_init()
241 struct eloop_timeout *timeout, *tmp; in eloop_register_timeout() local
244 timeout = os_zalloc(sizeof(*timeout)); in eloop_register_timeout()
245 if (timeout == NULL) in eloop_register_timeout()
247 if (os_get_reltime(&timeout->time) < 0) { in eloop_register_timeout()
248 os_free(timeout); in eloop_register_timeout()
251 now_sec = timeout->time.sec; in eloop_register_timeout()
252 timeout->time.sec += secs; in eloop_register_timeout()
253 if (timeout->time.sec < now_sec) { in eloop_register_timeout()
260 os_free(timeout); in eloop_register_timeout()
263 timeout->time.usec += usecs; in eloop_register_timeout()
264 while (timeout->time.usec >= 1000000) { in eloop_register_timeout()
265 timeout->time.sec++; in eloop_register_timeout()
266 timeout->time.usec -= 1000000; in eloop_register_timeout()
268 timeout->eloop_data = eloop_data; in eloop_register_timeout()
269 timeout->user_data = user_data; in eloop_register_timeout()
270 timeout->handler = handler; in eloop_register_timeout()
273 dl_list_for_each(tmp, &eloop.timeout, struct eloop_timeout, list) { in eloop_register_timeout()
274 if (os_reltime_before(&timeout->time, &tmp->time)) { in eloop_register_timeout()
275 dl_list_add(tmp->list.prev, &timeout->list); in eloop_register_timeout()
279 dl_list_add_tail(&eloop.timeout, &timeout->list); in eloop_register_timeout()
285 static void eloop_remove_timeout(struct eloop_timeout *timeout) in eloop_remove_timeout() argument
287 dl_list_del(&timeout->list); in eloop_remove_timeout()
288 os_free(timeout); in eloop_remove_timeout()
295 struct eloop_timeout *timeout, *prev; in eloop_cancel_timeout() local
298 dl_list_for_each_safe(timeout, prev, &eloop.timeout, in eloop_cancel_timeout()
300 if (timeout->handler == handler && in eloop_cancel_timeout()
301 (timeout->eloop_data == eloop_data || in eloop_cancel_timeout()
303 (timeout->user_data == user_data || in eloop_cancel_timeout()
305 eloop_remove_timeout(timeout); in eloop_cancel_timeout()
318 struct eloop_timeout *timeout, *prev; in eloop_cancel_timeout_one() local
325 dl_list_for_each_safe(timeout, prev, &eloop.timeout, in eloop_cancel_timeout_one()
327 if (timeout->handler == handler && in eloop_cancel_timeout_one()
328 (timeout->eloop_data == eloop_data) && in eloop_cancel_timeout_one()
329 (timeout->user_data == user_data)) { in eloop_cancel_timeout_one()
331 if (os_reltime_before(&now, &timeout->time)) in eloop_cancel_timeout_one()
332 os_reltime_sub(&timeout->time, &now, remaining); in eloop_cancel_timeout_one()
333 eloop_remove_timeout(timeout); in eloop_cancel_timeout_one()
346 dl_list_for_each(tmp, &eloop.timeout, struct eloop_timeout, list) { in eloop_is_timeout_registered()
364 dl_list_for_each(tmp, &eloop.timeout, struct eloop_timeout, list) { in eloop_deplete_timeout()
396 dl_list_for_each(tmp, &eloop.timeout, struct eloop_timeout, list) { in eloop_replenish_timeout()
540 (!dl_list_empty(&eloop.timeout) || eloop.reader_count > 0 || in eloop_run()
542 struct eloop_timeout *timeout; in eloop_run() local
544 timeout = dl_list_first(&eloop.timeout, struct eloop_timeout, in eloop_run()
546 if (timeout) { in eloop_run()
548 if (os_reltime_before(&now, &timeout->time)) in eloop_run()
549 os_reltime_sub(&timeout->time, &now, &tv); in eloop_run()
562 if (timeout) in eloop_run()
585 timeout = dl_list_first(&eloop.timeout, struct eloop_timeout, in eloop_run()
587 if (timeout) { in eloop_run()
589 if (!os_reltime_before(&now, &timeout->time)) { in eloop_run()
590 void *eloop_data = timeout->eloop_data; in eloop_run()
591 void *user_data = timeout->user_data; in eloop_run()
593 timeout->handler; in eloop_run()
594 eloop_remove_timeout(timeout); in eloop_run()
652 struct eloop_timeout *timeout, *prev; in eloop_destroy() local
654 dl_list_for_each_safe(timeout, prev, &eloop.timeout, in eloop_destroy()
656 eloop_remove_timeout(timeout); in eloop_destroy()