* select.cc (cygwin_select): Make sure that poll is called when appropriate.

This commit is contained in:
Christopher Faylor 2011-12-08 06:49:56 +00:00
parent 5025bf330b
commit 986da7853d
2 changed files with 22 additions and 25 deletions

View File

@ -1,3 +1,8 @@
2011-12-08 Christopher Faylor <me.cygwin2011@cgf.cx>
* select.cc (cygwin_select): Make sure that poll is called when
appropriate.
2011-12-08 Christopher Faylor <me.cygwin2011@cgf.cx>
* dll_init.cc (dll_dllcrt0): Don't try to initialize dll data if we're

View File

@ -124,7 +124,6 @@ cygwin_select (int maxfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
select_printf ("sel.always_ready %d", sel.always_ready);
int timeout = 0;
/* Allocate some fd_set structures using the number of fds as a guide. */
fd_set *r = allocfd_set (maxfds);
fd_set *w = allocfd_set (maxfds);
@ -133,33 +132,26 @@ cygwin_select (int maxfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
int res = 1;
/* Degenerate case. No fds to wait for. Just wait. */
if (sel.start.next == NULL)
{
switch (cygWFMO (0, ms))
{
case WAIT_OBJECT_0:
select_printf ("signal received");
set_sig_errno (EINTR);
return -1;
res = -1;
case WAIT_OBJECT_0 + 1:
sel.destroy ();
pthread::static_cancel_self ();
/*NOTREACHED*/
default:
res = 0;
break;
}
res = 0;
}
else if (sel.always_ready || ms == 0)
res = 0;
else if ((timeout = sel.wait (r, w, e, ms) < 0))
res = -1; /* some kind of error */
if (res >= 0)
else if ((sel.always_ready || ms == 0)
|| (res = sel.wait (r, w, e, ms)) == 0)
{
copyfd_set (readfds, r, maxfds);
copyfd_set (writefds, w, maxfds);
copyfd_set (exceptfds, e, maxfds);
if (res > 0)
res = sel.poll (readfds, writefds, exceptfds);
}