MINOR: fd: centralize poll timeout computation in compute_poll_timeout()
The 4 pollers all contain the same code used to compute the poll timeout.
This is pointless, let's centralize this into fd.h. This also gets rid of
the useless SCHEDULER_RESOLUTION macro which used to work arond a very old
linux 2.2 bug causing select() to wake up slightly before the timeout.
diff --git a/src/ev_epoll.c b/src/ev_epoll.c
index f672c66..b9980db 100644
--- a/src/ev_epoll.c
+++ b/src/ev_epoll.c
@@ -144,21 +144,8 @@
thread_harmless_now();
- /* compute the epoll_wait() timeout */
- if (!exp)
- wait_time = MAX_DELAY_MS;
- else if (tick_is_expired(exp, now_ms)) {
- activity[tid].poll_exp++;
- wait_time = 0;
- }
- else {
- wait_time = TICKS_TO_MS(tick_remain(now_ms, exp)) + 1;
- if (wait_time > MAX_DELAY_MS)
- wait_time = MAX_DELAY_MS;
- }
-
/* now let's wait for polled events */
-
+ wait_time = compute_poll_timeout(exp);
gettimeofday(&before_poll, NULL);
status = epoll_wait(epoll_fd[tid], epoll_events, global.tune.maxpollevents, wait_time);
tv_update_date(wait_time, status);