From: RĂ©mi Denis-Courmont Date: Sun, 18 Jan 2009 14:57:47 +0000 (+0200) Subject: Win32: wake up select every split tenth of seconds (fix #1949) X-Git-Tag: 1.0.0-pre1~1238 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=e9c23e9505aafc374b76c840986c3fe3fb9b1cb3;p=vlc Win32: wake up select every split tenth of seconds (fix #1949) --- diff --git a/src/network/poll.c b/src/network/poll.c index dc1482c875..553a7e59d7 100644 --- a/src/network/poll.c +++ b/src/network/poll.c @@ -85,6 +85,18 @@ int vlc_poll (struct pollfd *fds, unsigned nfds, int timeout) FD_SET (fd, &exset); } +#ifndef HAVE_ALERTABLE_SELECT +# warning FIXME! Fix cancellation and remove this crap. +resume: + vlc_testcancel (); + + if ((timeout < 0) || (timeout > 50)) + { + tv.tv_sec = 0; + tv.tv_usec = 50; + } + else +#endif if (timeout >= 0) { div_t d = div (timeout, 1000); @@ -94,6 +106,18 @@ int vlc_poll (struct pollfd *fds, unsigned nfds, int timeout) val = select (val + 1, &rdset, &wrset, &exset, (timeout >= 0) ? &tv : NULL); + +#ifndef HAVE_ALERTABLE_SELECT +# warning FIXME! Fix cancellation and remove this crap. + if (val == 0) + { + if (timeout > 0) + timeout -= (timeout > 50) ? 50 : timeout; + if (timeout != 0) + goto resume; + } +#endif + if (val == -1) return -1;