Windows - select.select, timeout and KeyboardInterrupt

Giampaolo Rodolà g.rodola at gmail.com
Sat May 8 11:03:07 EDT 2010


2010/5/8 Antoine Pitrou <solipsis at pitrou.net>:
> On Sat, 8 May 2010 13:47:53 +0200
> Giampaolo Rodolà <g.rodola at gmail.com> wrote:
>>
>> Assuming loop() function does something like this:
>>
>>      ...
>>      select.select(r, w, e, timeout)
>>      scheduler()  # checks for scheduled calls to be fired
>>      ...
>>
>> ...imagine a case where there's a connection (aka a dispatcher
>> instance) which does not receive or send any data *and* a scheduled
>> call which is supposed to be fired after, say, 5 seconds.
>> The entire loop would hang on select.select() which won't return for
>> 30 seconds because the socket is not ready for reading and/or writing
>> resulting in scheduler() be called too late.
>
> Well, obviously you have to change the timeout based on the delay for
> the next scheduled call. If your patch doesn't do that, it probably
> needs fixing :)
>
> Regards
>
> Antoine.

No it doesn't and I didn't consider this solution at the time.
Thanks. =)


--- Giampaolo
http://code.google.com/p/pyftpdlib
http://code.google.com/p/psutil



More information about the Python-list mailing list