[issue22018] Add a new signal.set_wakeup_socket() function

STINNER Victor report at bugs.python.org
Fri Jul 25 00:36:19 CEST 2014


STINNER Victor added the comment:

>> In fact, it works to write the signal number into a pipe on Windows, but I'm worried about the blocking behaviour.

> It wasn't different before, so I'm not sure why we should start to worry about it?

Does you have an idea if set_wakeup_fd() is used on Windows? It's not possible to use it with select.select() because on Windows this function only accepts sockets. I don't know if it's possible to watch a pipe using IOCP. Is set_wakeup_fd() used by Twisted, Tornado or another project on Windows?

I would like to modify signal.set_wakeup_fd() to make the file descriptor (or socket) non-blocking: see issue #22042. I proposed this change to protect the user against misuse of the API, and to make the API more convinient. asyncore and asyncio modules also make files and sockets non-blocking: asyncore.dispatcher(sock) and asyncio.BaseEventLoop.connect_read_pipe() for example.

Oh, by the way, sock_xxx() methods of asyncio.BaseEventLoop don't make the socket non-blocking, and the documentation doesn't require that sockets are already set to non-blocking mode. It looks like a bug (at least in the documentation).

----------

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


More information about the Python-bugs-list mailing list