Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e3666fc

Browse files
hniksic1st1
authored andcommitted
bpo-35465: Document _UnixSelectorEventLoop.add_signal_handler. (GH-11145)
1 parent d2a75c6 commit e3666fc

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
@@ -966,12 +966,20 @@ Unix signals
966966

967967
Set *callback* as the handler for the *signum* signal.
968968

969+
The callback will be invoked by *loop*, along with other queued callbacks
970+
and runnable coroutines of that event loop. Unlike signal handlers
971+
registered using :func:`signal.signal`, a callback registered with this
972+
function is allowed to interact with the event loop.
973+
969974
Raise :exc:`ValueError` if the signal number is invalid or uncatchable.
970975
Raise :exc:`RuntimeError` if there is a problem setting up the handler.
971976

972977
Use :func:`functools.partial` :ref:`to pass keyword arguments
973978
<asyncio-pass-keywords>` to *callback*.
974979

980+
Like :func:`signal.signal`, this function must be invoked in the main
981+
thread.
982+
975983
.. method:: loop.remove_signal_handler(sig)
976984

977985
Remove the handler for the *sig* signal.

0 commit comments

Comments
 (0)