From: Andre Noll Date: Mon, 15 Aug 2011 20:56:01 +0000 (+0200) Subject: sched: Zero-out fd sets on min delay. X-Git-Tag: v0.4.8~2 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=ec0c9721b6dfcbd70d7a1b318fb9b94e2aab9a5d 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. --- 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))