X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fnetwork%2Fpoll.c;h=553a7e59d72fa1a4dc8142a2d4c10b6a6993ff4e;hb=e9c23e9505aafc374b76c840986c3fe3fb9b1cb3;hp=d65eccd1cd178bae68ca1b85aeb64f554080f88c;hpb=ce27eace14ba974c24d393b8b7d56f2ea7dbad72;p=vlc diff --git a/src/network/poll.c b/src/network/poll.c index d65eccd1cd..553a7e59d7 100644 --- a/src/network/poll.c +++ b/src/network/poll.c @@ -25,9 +25,9 @@ # include "config.h" #endif -#include - #ifdef HAVE_POLL +#include + struct pollfd; int vlc_poll (struct pollfd *fds, unsigned nfds, int timeout) @@ -36,6 +36,8 @@ int vlc_poll (struct pollfd *fds, unsigned nfds, int timeout) abort (); } #else /* !HAVE_POLL */ + +#include #include #include #include @@ -83,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); @@ -92,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;