summaryrefslogtreecommitdiffstats
path: root/Doc/library
diff options
context:
space:
mode:
Diffstat (limited to 'Doc/library')
-rw-r--r--Doc/library/asyncio-runner.rst14
1 files changed, 10 insertions, 4 deletions
diff --git a/Doc/library/asyncio-runner.rst b/Doc/library/asyncio-runner.rst
index c43d664..b68b257 100644
--- a/Doc/library/asyncio-runner.rst
+++ b/Doc/library/asyncio-runner.rst
@@ -22,7 +22,7 @@ to simplify async code usage for common wide-spread scenarios.
Running an asyncio Program
==========================
-.. function:: run(coro, *, debug=None)
+.. function:: run(coro, *, debug=None, loop_factory=None)
Execute the :term:`coroutine` *coro* and return the result.
@@ -37,9 +37,11 @@ Running an asyncio Program
debug mode explicitly. ``None`` is used to respect the global
:ref:`asyncio-debug-mode` settings.
- This function always creates a new event loop and closes it at
- the end. It should be used as a main entry point for asyncio
- programs, and should ideally only be called once.
+ If *loop_factory* is not ``None``, it is used to create a new event loop;
+ otherwise :func:`asyncio.new_event_loop` is used. The loop is closed at the end.
+ This function should be used as a main entry point for asyncio programs,
+ and should ideally only be called once. It is recommended to use
+ *loop_factory* to configure the event loop instead of policies.
The executor is given a timeout duration of 5 minutes to shutdown.
If the executor hasn't finished within that duration, a warning is
@@ -62,6 +64,10 @@ Running an asyncio Program
*debug* is ``None`` by default to respect the global debug mode settings.
+ .. versionchanged:: 3.12
+
+ Added *loop_factory* parameter.
+
Runner context manager
======================