mirror of
https://github.com/python/cpython
synced 2026-09-29 12:10:30 +03:00
asyncio doc: mention that asyncio is not thread-safe
This commit is contained in:
parent
3e7cc03f63
commit
790202d613
1 changed files with 6 additions and 0 deletions
|
|
@ -23,6 +23,12 @@ schedule a coroutine from a different thread::
|
|||
|
||||
loop.call_soon_threadsafe(asyncio.async, coro_func())
|
||||
|
||||
Most asyncio objects are not thread safe. You should only worry if you access
|
||||
objects outside the event loop. For example, to cancel a future, don't call
|
||||
directly its :meth:`Future.cancel` method, but::
|
||||
|
||||
loop.call_soon_threadsafe(fut.cancel)
|
||||
|
||||
To handle signals and to execute subprocesses, the event loop must be run in
|
||||
the main thread.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue