/*
* speculative epoll() poller
*/
-REGPRM2 static void _do_poll(struct poller *p, int wait_time)
+REGPRM2 static void _do_poll(struct poller *p, struct timeval *exp)
{
static unsigned int last_skipped;
- int status;
+ int status, eo;
int fd, opcode;
int count;
int spec_idx;
tv_now(&now);
return;
}
+ }
+ last_skipped = 0;
+
+ if (nbspec || status) {
+ /* Maybe we have processed some events that we must report, or
+ * maybe we still have events in the spec list, so we must not
+ * wait in epoll() otherwise we will delay their delivery by
+ * the next timeout.
+ */
wait_time = 0;
}
- last_skipped = 0;
+ else {
+ if (tv_isset(exp))
+ wait_time = tv_ms_remain(&now, exp);
+ else
+ wait_time = -1;
+ }
- /* now let's wait for events */
+ /* now let's wait for real events */
status = epoll_wait(epoll_fd, epoll_events, maxfd, wait_time);
+
tv_now(&now);
for (count = 0; count < status; count++) {