changeset 15353:f3753e923660

poll: do not return 0 on timeout=-1 * lib/poll.c: Loop with yield if no events occured
author Erik Faye-Lund <kusmabite@gmail.com>
date Wed, 06 Jul 2011 12:10:51 +0200
parents c089b67729fe
children d27da2beda65
files ChangeLog lib/poll.c
diffstat 2 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2011-07-06  Erik Faye-Lund  <kusmabite@gmail.com>
+
+	poll: do not return 0 on timeout=-1
+	* lib/poll.c: Loop with yield if no events occured
+
 2011-07-06  Eric Blake  <eblake@redhat.com>
 
 	pthread_sigmask: always replace when not using pthread
--- a/lib/poll.c
+++ b/lib/poll.c
@@ -452,6 +452,7 @@
   if (!hEvent)
     hEvent = CreateEvent (NULL, FALSE, FALSE, NULL);
 
+restart:
   handle_array[0] = hEvent;
   nhandles = 1;
   FD_ZERO (&rfds);
@@ -592,6 +593,12 @@
         rc++;
     }
 
+  if (!rc && timeout == INFTIM)
+    {
+      SwitchToThread();
+      goto restart;
+    }
+
   return rc;
 #endif
 }