Skip to content

Commit

Permalink
compat/win32/poll.c: upgrade from upstream
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Erik Faye-Lund authored and Junio C Hamano committed Oct 31, 2011
1 parent 0f77dea commit f0bd664
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions compat/win32/poll.c
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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>
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -594,6 +595,12 @@ poll (pfd, nfd, timeout)
rc++;
}

if (!rc && timeout == INFTIM)
{
SwitchToThread();
goto restart;
}

return rc;
#endif
}

0 comments on commit f0bd664

Please sign in to comment.