diff options
author | Christopher Faylor <me@cgf.cx> | 2001-10-26 08:06:27 +0400 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2001-10-26 08:06:27 +0400 |
commit | fe00cca93e9d7e511d1e751e26b9476443772a4e (patch) | |
tree | 29dcba7370d0e45fc69a9bc0c58035b6425ee80f /winsup/cygwin/select.cc | |
parent | 53c79b98c9febdd482cf352f80e6b570d3a19d81 (diff) |
* select.cc (MAKEready): Check for read_ready in loop since select_read could
set it.
(peek_socket): Check ready/write/except specifically since they could have been
set even prior to peek_socket call.
Diffstat (limited to 'winsup/cygwin/select.cc')
-rw-r--r-- | winsup/cygwin/select.cc | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/winsup/cygwin/select.cc b/winsup/cygwin/select.cc index 8f1bab9ea..e07c23bb0 100644 --- a/winsup/cygwin/select.cc +++ b/winsup/cygwin/select.cc @@ -94,7 +94,8 @@ fhandler_##what::ready_for_read (int fd, DWORD howlong, int ignra) \ select_record me (this); \ me.fd = fd; \ (void) select_read (&me); \ - while (!peek_##what (&me, ignra) && howlong == INFINITE) \ + while (select_read (&me) && !me.read_ready && \ + !peek_##what (&me, ignra) && howlong == INFINITE) \ if (fd >= 0 && cygheap->fdtab.not_open (fd)) \ break; \ else if (WaitForSingleObject (signal_arrived, 10) == WAIT_OBJECT_0) \ @@ -1176,7 +1177,6 @@ peek_socket (select_record *me, int) WINSOCK_FD_ZERO (&ws_readfds); WINSOCK_FD_ZERO (&ws_writefds); WINSOCK_FD_ZERO (&ws_exceptfds); - int gotone = 0; HANDLE h; set_handle_or_return_if_not_open (h, me); @@ -1210,12 +1210,12 @@ peek_socket (select_record *me, int) } if (WINSOCK_FD_ISSET (h, &ws_readfds) || (me->read_selected && me->read_ready)) - gotone = me->read_ready = TRUE; + me->read_ready = TRUE; if (WINSOCK_FD_ISSET (h, &ws_writefds) || (me->write_selected && me->write_ready)) - gotone = me->write_ready = TRUE; + me->write_ready = TRUE; if (WINSOCK_FD_ISSET (h, &ws_exceptfds) || (me->except_selected && me->except_ready)) - gotone = me->except_ready = TRUE; - return gotone; + me->except_ready = TRUE; + return me->read_ready || me->write_ready || me->except_ready; } static int |