From 0e59dd68fcce7a5c77ba5bf1239d79a28c4006a0 Mon Sep 17 00:00:00 2001 From: Vincent Fu Date: Tue, 28 Apr 2020 11:27:14 -0600 Subject: [PATCH] helper_thread: cleanups - instead of always using a timeout of DISK_UTIL_MSEC, use a possibly shorter period for the select() timeout - drop the timespec_add_msec() call because the target is overwritten in short order by clock_gettime() Signed-off-by: Vincent Fu --- helper_thread.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/helper_thread.c b/helper_thread.c index 78749855..90bfab5c 100644 --- a/helper_thread.c +++ b/helper_thread.c @@ -164,13 +164,11 @@ static void *helper_thread_main(void *data) while (!ret && !hd->exit) { uint64_t since_du, since_ss = 0; struct timeval timeout = { - .tv_sec = DISK_UTIL_MSEC / 1000, - .tv_usec = (DISK_UTIL_MSEC % 1000) * 1000, + .tv_sec = msec_to_next_event / 1000, + .tv_usec = (msec_to_next_event % 1000) * 1000, }; fd_set rfds, efds; - timespec_add_msec(&ts, msec_to_next_event); - if (read_from_pipe(hd->pipe[0], &action, sizeof(action)) < 0) { FD_ZERO(&rfds); FD_SET(hd->pipe[0], &rfds); -- 2.25.1