Windows - select.select, timeout and KeyboardInterrupt

Antoine Pitrou solipsis at pitrou.net
Sat May 8 10:00:09 EDT 2010


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.



More information about the Python-list mailing list