Skip to content

Commit f0bd664

Browse files
kusmagitster
authored andcommitted
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>
1 parent 0f77dea commit f0bd664

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

compat/win32/poll.c

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* Emulation for poll(2)
22
Contributed by Paolo Bonzini.
33
4-
Copyright 2001-2003, 2006-2010 Free Software Foundation, Inc.
4+
Copyright 2001-2003, 2006-2011 Free Software Foundation, Inc.
55
66
This file is part of gnulib.
77
@@ -27,7 +27,10 @@
2727
#include <malloc.h>
2828

2929
#include <sys/types.h>
30-
#include "poll.h"
30+
31+
/* Specification. */
32+
#include <poll.h>
33+
3134
#include <errno.h>
3235
#include <limits.h>
3336
#include <assert.h>
@@ -314,10 +317,7 @@ compute_revents (int fd, int sought, fd_set *rfds, fd_set *wfds, fd_set *efds)
314317
#endif /* !MinGW */
315318

316319
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)
321321
{
322322
#ifndef WIN32_NATIVE
323323
fd_set rfds, wfds, efds;
@@ -454,6 +454,7 @@ poll (pfd, nfd, timeout)
454454
if (!hEvent)
455455
hEvent = CreateEvent (NULL, FALSE, FALSE, NULL);
456456

457+
restart:
457458
handle_array[0] = hEvent;
458459
nhandles = 1;
459460
FD_ZERO (&rfds);
@@ -594,6 +595,12 @@ poll (pfd, nfd, timeout)
594595
rc++;
595596
}
596597

598+
if (!rc && timeout == INFTIM)
599+
{
600+
SwitchToThread();
601+
goto restart;
602+
}
603+
597604
return rc;
598605
#endif
599606
}

0 commit comments

Comments
 (0)