summaryrefslogtreecommitdiff
path: root/compat/win32/poll.c
diff options
context:
space:
mode:
authorErik Faye-Lund <kusmabite@gmail.com>2011-10-24 16:02:10 (GMT)
committerJunio C Hamano <gitster@pobox.com>2011-10-31 01:45:16 (GMT)
commitf0bd664977b25e68c1230a533dd644706cff3ae2 (patch)
tree2c93bc7bf71b2ae7aadbf34f76a2bffe62b1f6e1 /compat/win32/poll.c
parent0f77dea9a80302b3b9acd1097fa3f2315d8aef0f (diff)
downloadgit-f0bd664977b25e68c1230a533dd644706cff3ae2.zip
git-f0bd664977b25e68c1230a533dd644706cff3ae2.tar.gz
git-f0bd664977b25e68c1230a533dd644706cff3ae2.tar.bz2
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>
Diffstat (limited to 'compat/win32/poll.c')
-rw-r--r--compat/win32/poll.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/compat/win32/poll.c b/compat/win32/poll.c
index 708a6c9..403eaa7 100644
--- a/compat/win32/poll.c
+++ b/compat/win32/poll.c
@@ -1,7 +1,7 @@
/* Emulation for poll(2)
Contributed by Paolo Bonzini.
- Copyright 2001-2003, 2006-2010 Free Software Foundation, Inc.
+ Copyright 2001-2003, 2006-2011 Free Software Foundation, Inc.
This file is part of gnulib.
@@ -27,7 +27,10 @@
#include <malloc.h>
#include <sys/types.h>
-#include "poll.h"
+
+/* Specification. */
+#include <poll.h>
+
#include <errno.h>
#include <limits.h>
#include <assert.h>
@@ -314,10 +317,7 @@ compute_revents (int fd, int sought, fd_set *rfds, fd_set *wfds, fd_set *efds)
#endif /* !MinGW */
int
-poll (pfd, nfd, timeout)
- struct pollfd *pfd;
- nfds_t nfd;
- int timeout;
+poll (struct pollfd *pfd, nfds_t nfd, int timeout)
{
#ifndef WIN32_NATIVE
fd_set rfds, wfds, efds;
@@ -454,6 +454,7 @@ poll (pfd, nfd, timeout)
if (!hEvent)
hEvent = CreateEvent (NULL, FALSE, FALSE, NULL);
+restart:
handle_array[0] = hEvent;
nhandles = 1;
FD_ZERO (&rfds);
@@ -594,6 +595,12 @@ poll (pfd, nfd, timeout)
rc++;
}
+ if (!rc && timeout == INFTIM)
+ {
+ SwitchToThread();
+ goto restart;
+ }
+
return rc;
#endif
}