Windows - select.select, timeout and KeyboardInterrupt

exarkun at twistedmatrix.com exarkun at twistedmatrix.com
Fri May 7 23:18:30 EDT 2010


On 7 May, 07:25 pm, p.f.moore at gmail.com wrote:
>On 7 May 2010 15:36, Giampaolo Rodolà <g.rodola at gmail.com> wrote:
>>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).
>
>Thanks, that's what I was considering.

This is a good example of why it's a bad idea to use select on Windows. 
Instead, use WaitForMultipleObjects.
>>Actually there's no reason for asyncore to have such a high default
>>timeout (30 seconds).
>
>I assumed it was to avoid busy waiting.
>>I think this should be signaled on the bug tracker.
>
>If a longer timeout doesn't have issues with busy waiting, then I'd 
>agree.

The *default* timeout is only the default.  An application that knows 
better can supply a different value.  I'm not sure how much good can be 
done by fiddling with the default.

Jean-Paul



More information about the Python-list mailing list