[vlc-devel] [PATCH] too long timeouts in win32 vlc_poll
Rafaël Carré
funman at videolan.org
Sun Feb 3 15:45:45 CET 2013
Le 03/02/2013 14:18, Mario Speiß a écrit :
> On 03.02.2013 13:09, Rafaël Carré wrote:
>> Le 03/02/2013 12:01, Mario Speiß a écrit :
>>> When vlc_poll is called with timeout of i.e. 5000ms it may happen that the
>>> waiting time might be as long as 2500s ! Probably poll should be called with
>>> the 50ms timeout as many times until the original provided timeout has been
>>> reached.
>>>
>>> Regards,
>>> Mario
>>> ---
>>> include/vlc_threads.h | 2 +-
>>> 1 files changed, 1 insertions(+), 1 deletions(-)
>>>
>>> diff --git a/include/vlc_threads.h b/include/vlc_threads.h
>>> index 7c6a4ca..337ded4 100644
>>> --- a/include/vlc_threads.h
>>> +++ b/include/vlc_threads.h
>>> @@ -392,7 +392,7 @@ static inline int vlc_poll (struct pollfd *fds, unsigned nfds, int timeout)
>>>
>>> while (timeout> 50)
>>> {
>>> - int val = poll (fds, nfds, timeout);
>>> + int val = poll (fds, nfds, 50);
>>> if (val != 0)
>>> return val;
>>> timeout -= 50;
>>>
>>
>> I think the problem is that if timeout is very long, the thread can not
>> be cancelled before that full timeout has been spent in poll()
>
> I experienced that issue when trying to connect to a non existing mms
> stream from tcp.c with a timeout of 5000 (ms). With the original code
> poll would be called 5000:50=100 times with timeouts of 5s, 4.95s, 4.9s
> and so on.
> That really seems wrong to me. With this patch the timeout occurs after
> 5 seconds.
OK, sorry I think I read the patch in reverse.
It looks correct of course.
Courmisch, do you agree?
> Regards,
> Mario
More information about the vlc-devel
mailing list