Commit 576c05f0 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

win32: do not get stuck in poll() with infinite timeout

This really should be fixed more properly.
parent ce96ee78
......@@ -388,18 +388,22 @@ struct vlc_cleanup_t
/* poll() with cancellation */
static inline int vlc_poll (struct pollfd *fds, unsigned nfds, int timeout)
{
vlc_testcancel ();
int val;
while (timeout > 50)
do
{
int val = poll (fds, nfds, 50);
if (val != 0)
return val;
timeout -= 50;
int ugly_timeout = 50;
if (timeout >= 50)
timeout -= 50;
else if ((unsigned)timeout < 50u)
ugly_timeout = timeout;
vlc_testcancel ();
val = poll (fds, nfds, ugly_timeout);
}
while (val == 0 && timeout != 0);
return poll (fds, nfds, timeout);
return val;
}
# define poll(u,n,t) vlc_poll(u, n, t)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment