Skip to content

Commit 12f3979

Browse files
miss-islingtonhniksic
authored andcommitted
bpo-35465: Document _UnixSelectorEventLoop.add_signal_handler. (GH-11145) (GH-11221)
(cherry picked from commit e3666fc) Co-authored-by: Hrvoje Nikšić <hniksic@gmail.com>
1 parent 60c919b commit 12f3979

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

Doc/library/asyncio-eventloop.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -960,12 +960,20 @@ Unix signals
960960

961961
Set *callback* as the handler for the *signum* signal.
962962

963+
The callback will be invoked by *loop*, along with other queued callbacks
964+
and runnable coroutines of that event loop. Unlike signal handlers
965+
registered using :func:`signal.signal`, a callback registered with this
966+
function is allowed to interact with the event loop.
967+
963968
Raise :exc:`ValueError` if the signal number is invalid or uncatchable.
964969
Raise :exc:`RuntimeError` if there is a problem setting up the handler.
965970

966971
Use :func:`functools.partial` :ref:`to pass keyword arguments
967972
<asyncio-pass-keywords>` to *callback*.
968973

974+
Like :func:`signal.signal`, this function must be invoked in the main
975+
thread.
976+
969977
.. method:: loop.remove_signal_handler(sig)
970978

971979
Remove the handler for the *sig* signal.

0 commit comments

Comments
 (0)