[issue7978] SocketServer doesn't handle syscall interruption

STINNER Victor report at bugs.python.org
Tue May 31 16:55:26 CEST 2011


STINNER Victor <victor.stinner at haypocalc.com> added the comment:

Using signalfd() (require Linux 2.6.22+), specified signals are written in a file and don't interrupt system calls (select). Bonus: we can wait for a signal using select!

Using pthread_sigmask(), you can also block signals before calling select, but it's not atomic. Or you can use pselect() which is pthread_sigmask()+select() in an atomic fashion.

pthread_sigmask() is already in Python 3.3, I plan to add signalfd() in a few weeks into Python 3.3. For pselect(), I don't know if we need it.

pthread_sigmask() is available on most POSIX systems, not on Windows. Can select() be interrupted by CTRL+c on Windows?

I don't say that we should not restart manually select() on EINTR, just that better solutions do exist today.

----------
nosy: +haypo

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7978>
_______________________________________


More information about the Python-bugs-list mailing list