connect SIGINT to custom interrupt handler

Nobody nobody at nowhere.com
Thu May 19 06:34:28 EDT 2011


On Wed, 18 May 2011 07:16:40 -0700, Jean-Paul Calderone wrote:

> Setting SA_RESTART on SIGINT is probably the right thing to do.  It's not
> totally clear to me from the messages in this thread if you managed to get
> that approach working.

He didn't; select() isn't SA_RESTART-able.

Unfortunately, the author of select.select() decided to treat EINTR as an
error. It isn't; it's a "third way", neither success nor failure, similar
to EAGAIN. Normally, you would treat EINTR from select() in the same way
as a timeout.

While it's possible to work around this, the interface encourages getting
it wrong.




More information about the Python-list mailing list