From: Erik Faye-Lund Date: Wed, 6 Jul 2011 10:10:51 +0000 (+0200) Subject: poll: do not return 0 on timeout=-1 X-Git-Tag: v0.1~2173 X-Git-Url: http://erislabs.org.uk/gitweb/?a=commitdiff_plain;h=adc3a5b0083c935f5dcd408983e37c78cb8ebd7c;p=gnulib.git poll: do not return 0 on timeout=-1 * lib/poll.c: Loop with yield if no events occured --- diff --git a/ChangeLog b/ChangeLog index e1ed45284..a0bfe3640 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-07-06 Erik Faye-Lund + + poll: do not return 0 on timeout=-1 + * lib/poll.c: Loop with yield if no events occured + 2011-07-06 Eric Blake pthread_sigmask: always replace when not using pthread diff --git a/lib/poll.c b/lib/poll.c index 8ce68c015..e06456581 100644 --- a/lib/poll.c +++ b/lib/poll.c @@ -452,6 +452,7 @@ poll (struct pollfd *pfd, nfds_t nfd, int timeout) if (!hEvent) hEvent = CreateEvent (NULL, FALSE, FALSE, NULL); +restart: handle_array[0] = hEvent; nhandles = 1; FD_ZERO (&rfds); @@ -592,6 +593,12 @@ poll (struct pollfd *pfd, nfds_t nfd, int timeout) rc++; } + if (!rc && timeout == INFTIM) + { + SwitchToThread(); + goto restart; + } + return rc; #endif }