Lines Matching refs:timeout
70 struct dl_list timeout; member
130 dl_list_init(&eloop.timeout); in eloop_init()
481 struct eloop_timeout *timeout, *tmp; in eloop_register_timeout() local
484 timeout = os_zalloc(sizeof(*timeout)); in eloop_register_timeout()
485 if (timeout == NULL) in eloop_register_timeout()
487 if (os_get_time(&timeout->time) < 0) { in eloop_register_timeout()
488 os_free(timeout); in eloop_register_timeout()
491 now_sec = timeout->time.sec; in eloop_register_timeout()
492 timeout->time.sec += secs; in eloop_register_timeout()
493 if (timeout->time.sec < now_sec) { in eloop_register_timeout()
500 os_free(timeout); in eloop_register_timeout()
503 timeout->time.usec += usecs; in eloop_register_timeout()
504 while (timeout->time.usec >= 1000000) { in eloop_register_timeout()
505 timeout->time.sec++; in eloop_register_timeout()
506 timeout->time.usec -= 1000000; in eloop_register_timeout()
508 timeout->eloop_data = eloop_data; in eloop_register_timeout()
509 timeout->user_data = user_data; in eloop_register_timeout()
510 timeout->handler = handler; in eloop_register_timeout()
511 wpa_trace_add_ref(timeout, eloop, eloop_data); in eloop_register_timeout()
512 wpa_trace_add_ref(timeout, user, user_data); in eloop_register_timeout()
513 wpa_trace_record(timeout); in eloop_register_timeout()
516 dl_list_for_each(tmp, &eloop.timeout, struct eloop_timeout, list) { in eloop_register_timeout()
517 if (os_time_before(&timeout->time, &tmp->time)) { in eloop_register_timeout()
518 dl_list_add(tmp->list.prev, &timeout->list); in eloop_register_timeout()
522 dl_list_add_tail(&eloop.timeout, &timeout->list); in eloop_register_timeout()
528 static void eloop_remove_timeout(struct eloop_timeout *timeout) in eloop_remove_timeout() argument
530 dl_list_del(&timeout->list); in eloop_remove_timeout()
531 wpa_trace_remove_ref(timeout, eloop, timeout->eloop_data); in eloop_remove_timeout()
532 wpa_trace_remove_ref(timeout, user, timeout->user_data); in eloop_remove_timeout()
533 os_free(timeout); in eloop_remove_timeout()
540 struct eloop_timeout *timeout, *prev; in eloop_cancel_timeout() local
543 dl_list_for_each_safe(timeout, prev, &eloop.timeout, in eloop_cancel_timeout()
545 if (timeout->handler == handler && in eloop_cancel_timeout()
546 (timeout->eloop_data == eloop_data || in eloop_cancel_timeout()
548 (timeout->user_data == user_data || in eloop_cancel_timeout()
550 eloop_remove_timeout(timeout); in eloop_cancel_timeout()
564 dl_list_for_each(tmp, &eloop.timeout, struct eloop_timeout, list) { in eloop_is_timeout_registered()
701 (!dl_list_empty(&eloop.timeout) || eloop.readers.count > 0 || in eloop_run()
703 struct eloop_timeout *timeout; in eloop_run() local
704 timeout = dl_list_first(&eloop.timeout, struct eloop_timeout, in eloop_run()
706 if (timeout) { in eloop_run()
708 if (os_time_before(&now, &timeout->time)) in eloop_run()
709 os_time_sub(&timeout->time, &now, &tv); in eloop_run()
726 timeout ? timeout_ms : -1); in eloop_run()
737 timeout ? &_tv : NULL); in eloop_run()
746 timeout = dl_list_first(&eloop.timeout, struct eloop_timeout, in eloop_run()
748 if (timeout) { in eloop_run()
750 if (!os_time_before(&now, &timeout->time)) { in eloop_run()
751 void *eloop_data = timeout->eloop_data; in eloop_run()
752 void *user_data = timeout->user_data; in eloop_run()
754 timeout->handler; in eloop_run()
755 eloop_remove_timeout(timeout); in eloop_run()
793 struct eloop_timeout *timeout, *prev; in eloop_destroy() local
797 dl_list_for_each_safe(timeout, prev, &eloop.timeout, in eloop_destroy()
800 sec = timeout->time.sec - now.sec; in eloop_destroy()
801 usec = timeout->time.usec - now.usec; in eloop_destroy()
802 if (timeout->time.usec < now.usec) { in eloop_destroy()
808 sec, usec, timeout->eloop_data, timeout->user_data, in eloop_destroy()
809 timeout->handler); in eloop_destroy()
811 timeout->handler); in eloop_destroy()
812 wpa_trace_dump("eloop timeout", timeout); in eloop_destroy()
813 eloop_remove_timeout(timeout); in eloop_destroy()