From: Willy Tarreau Date: Thu, 22 Nov 2018 17:57:37 +0000 (+0100) Subject: MINOR: poller: move the call of tv_update_date() back to the pollers X-Git-Tag: v1.9-dev8~16 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=48f8bc13685230b45dbcded7659bd8dbc6018791;p=thirdparty%2Fhaproxy.git MINOR: poller: move the call of tv_update_date() back to the pollers The reason behind this will be to be able to compute a timeout when busy polling. --- diff --git a/include/common/time.h b/include/common/time.h index b9efd714b9..c3f8f5c9e4 100644 --- a/include/common/time.h +++ b/include/common/time.h @@ -586,7 +586,6 @@ static inline void tv_entering_poll() */ static inline void tv_leaving_poll(int timeout, int interrupted) { - tv_update_date(timeout, interrupted); measure_idle(); prev_cpu_time = now_cpu_time(); prev_mono_time = now_mono_time(); diff --git a/src/ev_epoll.c b/src/ev_epoll.c index a9f96ab800..272ded2b43 100644 --- a/src/ev_epoll.c +++ b/src/ev_epoll.c @@ -150,6 +150,7 @@ REGPRM2 static void _do_poll(struct poller *p, int exp) tv_entering_poll(); activity_count_runtime(); status = epoll_wait(epoll_fd[tid], epoll_events, global.tune.maxpollevents, wait_time); + tv_update_date(wait_time, status); tv_leaving_poll(wait_time, status); thread_harmless_end(); diff --git a/src/ev_kqueue.c b/src/ev_kqueue.c index dc1310cff8..a894f66870 100644 --- a/src/ev_kqueue.c +++ b/src/ev_kqueue.c @@ -143,6 +143,7 @@ REGPRM2 static void _do_poll(struct poller *p, int exp) kev, // struct kevent *eventlist fd, // int nevents &timeout); // const struct timespec *timeout + tv_update_date(delta_ms, status); tv_leaving_poll(delta_ms, status); thread_harmless_end(); diff --git a/src/ev_poll.c b/src/ev_poll.c index ce5e38f96e..40bde873b5 100644 --- a/src/ev_poll.c +++ b/src/ev_poll.c @@ -198,6 +198,7 @@ REGPRM2 static void _do_poll(struct poller *p, int exp) tv_entering_poll(); activity_count_runtime(); status = poll(poll_events, nbfd, wait_time); + tv_update_date(wait_time, status); tv_leaving_poll(wait_time, status); thread_harmless_end(); diff --git a/src/ev_select.c b/src/ev_select.c index f435813aaa..f9b1215895 100644 --- a/src/ev_select.c +++ b/src/ev_select.c @@ -172,6 +172,7 @@ REGPRM2 static void _do_poll(struct poller *p, int exp) writenotnull ? tmp_evts[DIR_WR] : NULL, NULL, &delta); + tv_update_date(delta_ms, status); tv_leaving_poll(delta_ms, status); thread_harmless_end();