[vlc-devel] [PATCH 4/4] poll: if select() gave nothing and timeout is 0, don't read WSA events

Rémi Denis-Courmont remi at remlab.net
Wed Dec 2 23:32:50 CET 2015


On Tuesday 01 December 2015 10:40:50 Steve Lhomme wrote:
> ---
>  compat/poll.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/compat/poll.c b/compat/poll.c
> index da1e71c..b1629c2 100644
> --- a/compat/poll.c
> +++ b/compat/poll.c
> @@ -192,7 +192,7 @@ int poll(struct pollfd *fds, unsigned nfds, int timeout)
> }
> 
>      unsigned count = 0;
> -    if (ret == WSA_WAIT_FAILED)
> +    if (ret == WSA_WAIT_FAILED && to > 0)

This is a valid optimization. But if you are using this as bug "fix" rather 
than a mere optimization, then that seems racy/incomplete/wrong.

>      {
>          ret = WSAWaitForMultipleEvents(nfds, evts, FALSE, to, TRUE);

-- 
Rémi Denis-Courmont
http://www.remlab.net/



More information about the vlc-devel mailing list