bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] poll: do not return 0 on timeout=-1


From: Erik Faye-Lund
Subject: [PATCH] poll: do not return 0 on timeout=-1
Date: Wed, 6 Jul 2011 12:10:51 +0200

* lib/poll.c: Loop with yield if no events occured
---
OK, this should be a slightly more complete version. Added
SwitchToThread and mailing as a proper git-patch (including
a ChangeLog-entry) that can be applied with git-am.

 ChangeLog  |    5 +++++
 lib/poll.c |    7 +++++++
 2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index e56cd80..abd2640 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2011-07-06  Erik Faye-Lund  <address@hidden>
+
+       poll: do not return 0 on timeout=-1
+       * lib/poll.c: Loop with yield if no events occured
+
 2011-07-05  Jim Meyering  <address@hidden>
 
        maint: exempt stdio-read.c and stdio-write.c from the cppi check
diff --git a/lib/poll.c b/lib/poll.c
index 8ce68c0..e064565 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
 }
-- 
1.7.6.rc0.4055.gbf1a7




reply via email to

[Prev in Thread] Current Thread [Next in Thread]