compat/win32/poll.c: upgrade from upstream
poll.c is updated from revision adc3a5b in git://git.savannah.gnu.org/gnulib.git The changes are applied with --whitespace=fix to reduce noise. poll.h is not upgraded, because the most recent version now contains template-stuff that breaks compilation for us. Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com> Acked-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Erik Faye-Lund committed
Oct 24, 2011 at 18:02 UTC
f0bd664977b25e68c1230a533dd644706cff3ae2
1 file changed
+13
-6
compat/win32/poll.c
+13
-6
@@ -1,7 +1,7 @@
1
/* Emulation for poll(2)
2
Contributed by Paolo Bonzini.
3
4
- Copyright 2001-2003, 2006-2010 Free Software Foundation, Inc.
4
+ Copyright 2001-2003, 2006-2011 Free Software Foundation, Inc.
5
6
This file is part of gnulib.
7
@@ -27,7 +27,10 @@
27
#include <malloc.h>
28
29
#include <sys/types.h>
30
-#include "poll.h"
30
+
31
+/* Specification. */
32
+#include <poll.h>
33
+
34
#include <errno.h>
35
#include <limits.h>
36
#include <assert.h>
@@ -314,10 +317,7 @@ compute_revents (int fd, int sought, fd_set *rfds, fd_set *wfds, fd_set *efds)
317
#endif /* !MinGW */
318
319
int
317
-poll (pfd, nfd, timeout)
318
- struct pollfd *pfd;
319
- nfds_t nfd;
320
- int timeout;
320
+poll (struct pollfd *pfd, nfds_t nfd, int timeout)
321
{
322
#ifndef WIN32_NATIVE
323
fd_set rfds, wfds, efds;
@@ -454,6 +454,7 @@ poll (pfd, nfd, timeout)
454
if (!hEvent)
455
hEvent = CreateEvent (NULL, FALSE, FALSE, NULL);
456
457
+restart:
458
handle_array[0] = hEvent;
459
nhandles = 1;
460
FD_ZERO (&rfds);
@@ -594,6 +595,12 @@ poll (pfd, nfd, timeout)
595
rc++;
596
}
597
598
+ if (!rc && timeout == INFTIM)
599
+ {
600
+ SwitchToThread();
601
+ goto restart;
602
+ }
603
+
604
return rc;
605
#endif
606
}