diff options
| author | Andrew Svetlov <andrew.svetlov@gmail.com> | 2019-06-30 12:54:59 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-06-30 12:54:59 +0300 |
| commit | 0d671c04c39b52e44597491b893eb0b6c86b3d45 (patch) | |
| tree | b48295515be5ed2aed7babe62a924266edfdde6a /Doc/library/asyncio-subprocess.rst | |
| parent | 5cbbbd73a6acb6f96f5d6646aa7498d3dfb1706d (diff) | |
| download | cpython-git-0d671c04c39b52e44597491b893eb0b6c86b3d45.tar.gz | |
bpo-35621: Support running subprocesses in asyncio when loop is executed in non-main thread (GH-14344)
Diffstat (limited to 'Doc/library/asyncio-subprocess.rst')
| -rw-r--r-- | Doc/library/asyncio-subprocess.rst | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/Doc/library/asyncio-subprocess.rst b/Doc/library/asyncio-subprocess.rst index 00dc66c48b..444fb6361b 100644 --- a/Doc/library/asyncio-subprocess.rst +++ b/Doc/library/asyncio-subprocess.rst @@ -293,18 +293,26 @@ their completion. Subprocess and Threads ---------------------- -Standard asyncio event loop supports running subprocesses from -different threads, but there are limitations: +Standard asyncio event loop supports running subprocesses from different threads by +default. -* An event loop must run in the main thread. +On Windows subprocesses are provided by :class:`ProactorEventLoop` only (default), +:class:`SelectorEventLoop` has no subprocess support. -* The child watcher must be instantiated in the main thread - before executing subprocesses from other threads. Call the - :func:`get_child_watcher` function in the main thread to instantiate - the child watcher. +On UNIX *child watchers* are used for subprocess finish waiting, see +:ref:`asyncio-watchers` for more info. -Note that alternative event loop implementations might not share -the above limitations; please refer to their documentation. + +.. versionchanged:: 3.8 + + UNIX switched to use :class:`ThreadedChildWatcher` for spawning subprocesses from + different threads without any limitation. + + Spawning a subprocess with *inactive* current child watcher raises + :exc:`RuntimeError`. + +Note that alternative event loop implementations might have own limitations; +please refer to their documentation. .. seealso:: |
