File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -74,6 +74,11 @@ the event loop.
7474 The :ref: `Synchronization primitives <asyncio-sync >` section describes ways
7575 to synchronize tasks.
7676
77+ The :ref: `Subprocess and threads <asyncio-subprocess-threads >` section lists
78+ asyncio limitations to run subprocesses from different threads.
79+
80+
81+
7782
7883.. _asyncio-handle-blocking :
7984
Original file line number Diff line number Diff line change @@ -297,6 +297,25 @@ Process
297297 ``N `` (Unix only).
298298
299299
300+ .. _asyncio-subprocess-threads :
301+
302+ Subprocess and threads
303+ ======================
304+
305+ asyncio supports running subprocesses from different threads, but there
306+ are limits:
307+
308+ * An event loop must run in the main thread
309+ * The child watcher must be instantiated in the main thread, before executing
310+ subprocesses from other threads. Call the :func: `get_child_watcher `
311+ function in the main thread to instantiate the child watcher.
312+
313+ .. seealso ::
314+
315+ The :ref: `Concurrency and multithreading in asyncio
316+ <asyncio-multithreading>` section.
317+
318+
300319Subprocess examples
301320===================
302321
You can’t perform that action at this time.
0 commit comments