[issue22042] signal.set_wakeup_fd(fd): raise an exception if the fd is in blocking mode

STINNER Victor report at bugs.python.org
Wed Jul 30 00:22:45 CEST 2014


STINNER Victor added the comment:

I commited my patch to support sockets in signal.set_wakeup_fd() on Windows.

I updated my patch. It doesn't change signal.set_wakeup_fd() on Windows anymore. It only raises an exception on POSIX if the file descriptor is blocking.

On Windows, it's not possible to make a file non-blocking and so the signal handler may block on writing in the file. Antoine Pitrou doesn't want to change the behaviour, he prefers to still support files even if there is the possible hang.

On Windows, it's not possible to check if a socket handle is blocking or not. So set_wakeup_fd() doesn't check if the socket is blocking or not on Windows.

At least, the check can be implemented on POSIX.

--

An alternative is to make the file descriptor non-blocking in set_wakeup_fd(). In this case, I suggest to drop support of files on Windows because files cannot be set in non-blocking mode.

----------
Added file: http://bugs.python.org/file36156/signal_check_nonblocking-2.patch

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


More information about the Python-bugs-list mailing list