sched: Zero-out fd sets on min delay.
authorAndre Noll <maan@systemlinux.org>
Mon, 15 Aug 2011 20:56:01 +0000 (22:56 +0200)
committerAndre Noll <maan@systemlinux.org>
Thu, 18 Aug 2011 20:13:50 +0000 (22:13 +0200)
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

diff --git a/sched.c b/sched.c
index 385dde6..06aabe0 100644 (file)
--- 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))