diff --git a/utils.c b/utils.c index d5df179..8be61d6 100644 --- a/utils.c +++ b/utils.c @@ -1223,12 +1223,12 @@ poller_run (struct poller *self) self->dispatch_next = 0; self->dispatch_total = n_fds; - poller_timers_dispatch (&self->timers); - poller_idle_dispatch (self->idle); - // Sort them by file descriptor number for binary search qsort (self->revents, n_fds, sizeof *self->revents, poller_compare_fds); + poller_timers_dispatch (&self->timers); + poller_idle_dispatch (self->idle); + while (self->dispatch_next < self->dispatch_total) { struct epoll_event *revents = self->revents + self->dispatch_next;