X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fpoll.c;h=b012ba0350ae94a08d27fbeadf99e73bbb49f541;hb=5be861ac45514c2a0bc4c328de34af48fdad4283;hp=a001c199a83be3f6c706282fddcf63bcb3dccd6d;hpb=11f1d3a976a737eb6ca30cf89e8b47c85bfe3d47;p=gnulib.git diff --git a/lib/poll.c b/lib/poll.c index a001c199a..b012ba035 100644 --- a/lib/poll.c +++ b/lib/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. @@ -43,6 +43,7 @@ # include # include # include +# include "msvc-nothrow.h" #else # include # include @@ -315,10 +316,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; @@ -455,6 +453,7 @@ poll (pfd, nfd, timeout) if (!hEvent) hEvent = CreateEvent (NULL, FALSE, FALSE, NULL); +restart: handle_array[0] = hEvent; nhandles = 1; FD_ZERO (&rfds); @@ -595,6 +594,12 @@ poll (pfd, nfd, timeout) rc++; } + if (!rc && timeout == INFTIM) + { + SwitchToThread(); + goto restart; + } + return rc; #endif }