Signal SIGINT ignored during socket.accept
marko at pacujo.net
Fri Sep 11 16:00:30 CEST 2015
Grant Edwards <invalid at invalid.invalid>:
> On 2015-09-11, Chris Angelico <rosuav at gmail.com> wrote:
>> This is what I meant when I said you would be polling. Effectively,
>> you wake up your program every half-second, check if Ctrl-C has been
>> pressed, and if it hasn't, you go back to sleep again. This is pretty
> Though it offends one's engineering sensibilities, it's just not
> that inefficient. I'd bet money you won't even be able to measure the
> difference in CPU usage. Waking up twice per second and immediately
> calling select() again on any hardware/OS built in the past 50 years
> is going completely negligible (as long as you can ignore the smell).
> Even waking up ten times per second won't be noticeable.
> Waking up every millisecond or two might be noticeable.
It can add up. In particular, it can prevent the CPU from staying in the
low-power mode, especially on battery-powered devices.
Another environment where such polling circuses can actually overwhelm a
CPU is virtual machines. When dozens or hundreds of VMs are each polling
left and right, the host may not get much actual work done.
More information about the Python-list