Lines Matching refs:poller

707 struct poller *console_poller_register(struct console *console,  in console_poller_register()
713 struct poller *poller; in console_poller_register() local
723 poller = malloc(sizeof(*poller)); in console_poller_register()
725 poller->remove = false; in console_poller_register()
726 poller->handler = handler; in console_poller_register()
727 poller->event_fn = poller_fn; in console_poller_register()
728 poller->timeout_fn = timeout_fn; in console_poller_register()
729 timerclear(&poller->timeout); in console_poller_register()
730 poller->data = data; in console_poller_register()
731 poller->pollfd_index = index; in console_poller_register()
745 console->pollers[n] = poller; in console_poller_register()
747 return poller; in console_poller_register()
750 void console_poller_unregister(struct console *console, struct poller *poller) in console_poller_unregister() argument
756 if (console->pollers[i] == poller) { in console_poller_unregister()
785 console_server_release_pollfd(console->server, poller->pollfd_index); in console_poller_unregister()
787 free(poller); in console_poller_unregister()
790 void console_poller_set_events(struct console *console, struct poller *poller, in console_poller_set_events() argument
793 console->server->pollfds[poller->pollfd_index].events = in console_poller_set_events()
798 struct poller *poller, const struct timeval *tv) in console_poller_set_timeout() argument
808 timeradd(&now, tv, &poller->timeout); in console_poller_set_timeout()
815 struct poller *poller; in get_poll_timeout() local
821 poller = console->pollers[i]; in get_poll_timeout()
823 if (poller->timeout_fn && timerisset(&poller->timeout) && in get_poll_timeout()
825 (earliest && timercmp(&poller->timeout, earliest, <)))) { in get_poll_timeout()
828 earliest = &poller->timeout; in get_poll_timeout()
848 struct poller *poller; in call_pollers() local
861 poller = console->pollers[i]; in call_pollers()
862 pollfd = &console->server->pollfds[poller->pollfd_index]; in call_pollers()
872 prc = poller->event_fn(poller->handler, pollfd->revents, in call_pollers()
873 poller->data); in call_pollers()
877 poller->remove = true; in call_pollers()
881 if ((prc == POLLER_OK) && poller->timeout_fn && in call_pollers()
882 timerisset(&poller->timeout) && in call_pollers()
883 timercmp(&poller->timeout, cur_time, <=)) { in call_pollers()
888 timerclear(&poller->timeout); in call_pollers()
889 prc = poller->timeout_fn(poller->handler, poller->data); in call_pollers()
893 poller->remove = true; in call_pollers()
906 poller = console->pollers[i]; in call_pollers()
907 if (poller->remove) { in call_pollers()
908 console_poller_unregister(console, poller); in call_pollers()