From ec0c9721b6dfcbd70d7a1b318fb9b94e2aab9a5d Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Mon, 15 Aug 2011 22:56:01 +0200 Subject: [PATCH] sched: Zero-out fd sets on min delay. If at least one pre_select method requests a minimal delay, we don't call select() anymore as it would return immediately anyway. However, the fds that have already been set by previous pre_select methods are then treated as ready for IO in post_seelect which they most likely are not. This causes unnecessary calls to readv() and friends which returned EAGAIN. Fix this by clearing all fd sets in case of minimal timeouts. --- sched.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sched.c b/sched.c index 385dde61..06aabe02 100644 --- a/sched.c +++ b/sched.c @@ -159,6 +159,9 @@ again: FD_ZERO(&s->wfds); } gettimeofday(now, NULL); + } else { + FD_ZERO(&s->rfds); + FD_ZERO(&s->wfds); } sched_post_select(s); if (list_empty(&pre_select_list) && list_empty(&post_select_list)) -- 2.39.5