Skip to content

Commit e12b3c2

Browse files
authored
pythongh-79149 Document call_soon_threadsafe as signal safe
1 parent a391b74 commit e12b3c2

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Doc/library/asyncio-eventloop.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,18 +210,23 @@ Scheduling callbacks
210210
used later to cancel the callback.
211211

212212
This method is not thread-safe.
213+
Note: Although this is safe to call from a signal handler (since it may not use locks),
214+
the event loop will not wake up from a call to the IO multiplexer.
213215

214216
.. method:: loop.call_soon_threadsafe(callback, *args, context=None)
215217

216218
A thread-safe variant of :meth:`call_soon`. Must be used to
217219
schedule callbacks *from another thread*.
220+
The returned Handle, however, is not thread-safe.
218221

219222
Raises :exc:`RuntimeError` if called on a loop that's been closed.
220223
This can happen on a secondary thread when the main application is
221224
shutting down.
222225

223226
See the :ref:`concurrency and multithreading <asyncio-multithreading>`
224227
section of the documentation.
228+
229+
Note: this is safe to call from a signal handler (since it may not use locks)
225230

226231
.. versionchanged:: 3.7
227232
The *context* keyword-only parameter was added. See :pep:`567`

0 commit comments

Comments
 (0)