gevent.signal– Cooperative implementation of special cases of
This module is designed to work with libev’s child watchers, as used
by default in
gevent.os.fork() Note that each
will be run in a new greenlet when the signal is delivered (just like
The implementations in this module are only monkey patched if
gevent.os.waitpid() is being used (the default) and if
signal.SIGCHLD is available; see
information on configuring this not to be the case for advanced uses.
New in version 1.1b4.
Exactly the same as
signal.signal() except where
signal.SIGCHLD is concerned.
signal.SIGCHLD handler installed with this function
will only be triggered for children that are forked using
children forked before monkey patching, or otherwise by the raw
os.fork(), will not trigger the handler installed by this
function. (It’s unlikely that a SIGCHLD handler installed with
signal.signal() would be triggered either;
libev typically overwrites such a handler at the C level. At
the very least, it’s full of race conditions.)
SIG_DFL may also have race conditions
with libev child watchers and the
Changed in version 1.2a1: If
SIG_DFL are used to ignore
future use of
gevent.subprocess and libev child watchers
will once again work. However, on Python 2, use of
Changed in version 1.1rc2: Allow using
SIG_DFL to reset and ignore
However, this allows the possibility of a race condition if
had already been used.
gevent.pool – Managing greenlets in a group