From 1c80bbfa5fffc0070503f9b69d31885043e68755 Mon Sep 17 00:00:00 2001 From: Roger Dahl Date: Tue, 25 Feb 2020 19:08:41 -0700 Subject: [PATCH 1/4] Add caveats to add_signal_handler() Add information about potential delays in callbacks registered by this function, and a note about the side effect that corresponding handlers registered directly by signal.signal() are implicitly removed. --- Doc/library/asyncio-eventloop.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Doc/library/asyncio-eventloop.rst b/Doc/library/asyncio-eventloop.rst index d60a6ce95cdd87c..e899227707907c1 100644 --- a/Doc/library/asyncio-eventloop.rst +++ b/Doc/library/asyncio-eventloop.rst @@ -1046,6 +1046,14 @@ Unix signals Like :func:`signal.signal`, this function must be invoked in the main thread. + + While signal handlers registered using :func:`signal.signal` will + typically be called immediately, handlers registered using this + method are subject to potential delays while waiting for other + work in the given event loop to be completed. + + Any event handler set for the same signal via :func:`signal.signal` + is implicitly removed by this method. .. method:: loop.remove_signal_handler(sig) From 43c1066e942b755be601b04b145ecd03df4cad6a Mon Sep 17 00:00:00 2001 From: Roger Dahl Date: Wed, 26 Feb 2020 14:09:25 -0700 Subject: [PATCH 2/4] Remove trailing whitespace --- Doc/library/asyncio-eventloop.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/asyncio-eventloop.rst b/Doc/library/asyncio-eventloop.rst index e899227707907c1..a4eabacaf851ab0 100644 --- a/Doc/library/asyncio-eventloop.rst +++ b/Doc/library/asyncio-eventloop.rst @@ -1049,7 +1049,7 @@ Unix signals While signal handlers registered using :func:`signal.signal` will typically be called immediately, handlers registered using this - method are subject to potential delays while waiting for other + method are subject to potential delays while waiting for other work in the given event loop to be completed. Any event handler set for the same signal via :func:`signal.signal` From ce10bb591764a53858321fd4da48d65c32adcb31 Mon Sep 17 00:00:00 2001 From: Roger Dahl Date: Fri, 28 Feb 2020 00:45:54 -0700 Subject: [PATCH 3/4] Improve wording --- Doc/library/asyncio-eventloop.rst | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Doc/library/asyncio-eventloop.rst b/Doc/library/asyncio-eventloop.rst index a4eabacaf851ab0..741de5e98d15f28 100644 --- a/Doc/library/asyncio-eventloop.rst +++ b/Doc/library/asyncio-eventloop.rst @@ -1047,13 +1047,13 @@ Unix signals Like :func:`signal.signal`, this function must be invoked in the main thread. - While signal handlers registered using :func:`signal.signal` will - typically be called immediately, handlers registered using this - method are subject to potential delays while waiting for other - work in the given event loop to be completed. - - Any event handler set for the same signal via :func:`signal.signal` - is implicitly removed by this method. + While signal handlers registered using :func:`signal.signal` will typically be + called without significant delays as seen from the perspective of an + interactive user, signal callbacks in asyncio are subject to additional + delays while waiting for other work in the given event loop to be completed. + + Any event handler set for the same signal via :func:`signal.signal` is + implicitly removed by this method. .. method:: loop.remove_signal_handler(sig) From ef7b5660e1bb73e3bb4d06d541a49fbc23bafa01 Mon Sep 17 00:00:00 2001 From: Roger Dahl Date: Fri, 28 Feb 2020 17:30:08 -0700 Subject: [PATCH 4/4] Remove whitespace --- Doc/library/asyncio-eventloop.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/asyncio-eventloop.rst b/Doc/library/asyncio-eventloop.rst index 741de5e98d15f28..ac0e50a7e7c6dbc 100644 --- a/Doc/library/asyncio-eventloop.rst +++ b/Doc/library/asyncio-eventloop.rst @@ -1046,7 +1046,7 @@ Unix signals Like :func:`signal.signal`, this function must be invoked in the main thread. - + While signal handlers registered using :func:`signal.signal` will typically be called without significant delays as seen from the perspective of an interactive user, signal callbacks in asyncio are subject to additional