]> granicus.if.org Git - python/commitdiff
asyncio doc: list limitations to run subprocesses from different threads
authorVictor Stinner <victor.stinner@gmail.com>
Fri, 9 Jan 2015 00:32:02 +0000 (01:32 +0100)
committerVictor Stinner <victor.stinner@gmail.com>
Fri, 9 Jan 2015 00:32:02 +0000 (01:32 +0100)
Doc/library/asyncio-dev.rst
Doc/library/asyncio-subprocess.rst

index 63af06a9515aabbf3f7f0eb9dc3e6a8dbd332697..7083e60061ce8984596c79aba2fdf8e08c1a9f97 100644 (file)
@@ -74,6 +74,11 @@ the event loop.
    The :ref:`Synchronization primitives <asyncio-sync>` section describes ways
    to synchronize tasks.
 
+   The :ref:`Subprocess and threads <asyncio-subprocess-threads>` section lists
+   asyncio limitations to run subprocesses from different threads.
+
+
+
 
 .. _asyncio-handle-blocking:
 
index 1cbfcf21a7f236668af8b133f730bd1a08ad68c5..570107e3e4ca7443e4b3ab864db541f9495c8784 100644 (file)
@@ -297,6 +297,25 @@ Process
       ``N`` (Unix only).
 
 
+.. _asyncio-subprocess-threads:
+
+Subprocess and threads
+======================
+
+asyncio supports running subprocesses from different threads, but there
+are limits:
+
+* An event loop must run in the main thread
+* 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.
+
+.. seealso::
+
+   The :ref:`Concurrency and multithreading in asyncio
+   <asyncio-multithreading>` section.
+
+
 Subprocess examples
 ===================