Windows - select.select, timeout and KeyboardInterrupt

Giampaolo Rodolà g.rodola at gmail.com
Fri May 7 15:55:15 EDT 2010


2010/5/7 Antoine Pitrou <solipsis at pitrou.net>:
> Le Fri, 07 May 2010 16:36:44 +0200, Giampaolo Rodolà a écrit :
>> You can easily avoid this by setting a lower timeout when calling
>> asyncore.loop(), like 1 second or less (for example, Twisted uses 0.001
>> secs).
>> Actually there's no reason for asyncore to have such a high default
>> timeout (30 seconds).
>
> The reason for a high default timeout would be to avoid waking the CPU
> and do useless work too often. This is important on laptops and smaller
> devices, in order to conserve power.
>

Of course, but 30 seconds look a little bit too much to me, also
because (I might be wrong here) I noticed that a smaller timeout seems
to result in better performances.
Plus, if scheduled callbacks are ever gonna be added to asyncore we
would be forced to lower the default timeout anyway in order to have a
decent reactivity.


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



More information about the Python-list mailing list