This is the mail archive of the
cygwin-cvs@cygwin.com
mailing list for the Cygwin project.
[newlib-cygwin] select(2): Drop checking descriptors in case of immediate timeout.
- From: Corinna Vinschen <corinna at sourceware dot org>
- To: cygwin-cvs at sourceware dot org
- Date: 11 Jan 2016 09:36:41 -0000
- Subject: [newlib-cygwin] select(2): Drop checking descriptors in case of immediate timeout.
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=20ddde2f552afedf7ef662bb21fec7a56f50040f
commit 20ddde2f552afedf7ef662bb21fec7a56f50040f
Author: Corinna Vinschen <corinna@vinschen.de>
Date: Mon Jan 11 10:36:33 2016 +0100
select(2): Drop checking descriptors in case of immediate timeout.
* select.cc (select): Call sel.poll only if sel.wait returned
select_ok.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diff:
---
winsup/cygwin/select.cc | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/winsup/cygwin/select.cc b/winsup/cygwin/select.cc
index b4c3778..fa6859c 100644
--- a/winsup/cygwin/select.cc
+++ b/winsup/cygwin/select.cc
@@ -189,12 +189,17 @@ select (int maxfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
UNIX_FD_ZERO (readfds, maxfds);
UNIX_FD_ZERO (writefds, maxfds);
UNIX_FD_ZERO (exceptfds, maxfds);
- /* Set bit mask from sel records even in case of a timeout so we
- don't miss one. This also sets ret to the right value >= 0,
- matching the number of bits set in the fds records. */
- ret = sel.poll (readfds, writefds, exceptfds);
- if (!ret && res != select_stuff::select_set_zero)
- res = select_stuff::select_loop;
+ if (res == select_stuff::select_set_zero)
+ ret = 0;
+ else
+ {
+ /* Set bit mask from sel records. This also sets ret to the
+ right value >= 0, matching the number of bits set in the
+ fds records. if ret is 0, continue to loop. */
+ ret = sel.poll (readfds, writefds, exceptfds);
+ if (!ret)
+ res = select_stuff::select_loop;
+ }
}
/* Always clean up everything here. If we're looping then build it
all up again. */