summaryrefslogtreecommitdiffstats
path: root/Doc/library
diff options
context:
space:
mode:
authorKyle Stanley <aeros167@gmail.com>2019-09-19 12:47:22 (GMT)
committerAndrew Svetlov <andrew.svetlov@gmail.com>2019-09-19 12:47:22 (GMT)
commit9fdc64cf1266b6d5bf0503847b5c38e5edc53a14 (patch)
treeb2c07128fa5ef4fe3117604235199a618c0d10e5 /Doc/library
parent3171d67a6aaf7fe88685b3a80644f0284686ef63 (diff)
downloadcpython-9fdc64cf1266b6d5bf0503847b5c38e5edc53a14.zip
cpython-9fdc64cf1266b6d5bf0503847b5c38e5edc53a14.tar.gz
cpython-9fdc64cf1266b6d5bf0503847b5c38e5edc53a14.tar.bz2
bpo-34037: Fix test_asyncio failure and add loop.shutdown_default_executor() (GH-15735)
Diffstat (limited to 'Doc/library')
-rw-r--r--Doc/library/asyncio-eventloop.rst12
-rw-r--r--Doc/library/asyncio-task.rst6
2 files changed, 16 insertions, 2 deletions
diff --git a/Doc/library/asyncio-eventloop.rst b/Doc/library/asyncio-eventloop.rst
index 8f7974b..2fd4cf3 100644
--- a/Doc/library/asyncio-eventloop.rst
+++ b/Doc/library/asyncio-eventloop.rst
@@ -167,6 +167,18 @@ Running and stopping the loop
.. versionadded:: 3.6
+.. coroutinemethod:: loop.shutdown_default_executor()
+
+ Schedule the closure of the default executor and wait for it to join all of
+ the threads in the :class:`ThreadPoolExecutor`. After calling this method, a
+ :exc:`RuntimeError` will be raised if :meth:`loop.run_in_executor` is called
+ while using the default executor.
+
+ Note that there is no need to call this function when
+ :func:`asyncio.run` is used.
+
+ .. versionadded:: 3.9
+
Scheduling callbacks
^^^^^^^^^^^^^^^^^^^^
diff --git a/Doc/library/asyncio-task.rst b/Doc/library/asyncio-task.rst
index 57e0e07..d932042 100644
--- a/Doc/library/asyncio-task.rst
+++ b/Doc/library/asyncio-task.rst
@@ -213,8 +213,8 @@ Running an asyncio Program
.. function:: run(coro, \*, debug=False)
This function runs the passed coroutine, taking care of
- managing the asyncio event loop and *finalizing asynchronous
- generators*.
+ managing the asyncio event loop, *finalizing asynchronous
+ generators*, and closing the threadpool.
This function cannot be called when another asyncio event loop is
running in the same thread.
@@ -229,6 +229,8 @@ Running an asyncio Program
**Important:** this function has been added to asyncio in
Python 3.7 on a :term:`provisional basis <provisional api>`.
+ .. versionchanged:: 3.9
+ Updated to use :meth:`loop.shutdown_default_executor`.
Creating Tasks
==============