summaryrefslogtreecommitdiffstats
path: root/Doc/library
diff options
context:
space:
mode:
authorAndrew Svetlov <andrew.svetlov@gmail.com>2017-12-16 19:58:38 (GMT)
committerGitHub <noreply@github.com>2017-12-16 19:58:38 (GMT)
commit44d1a5912ea629aa20fdc377a5ab69d9ccf75d61 (patch)
tree8634c0010adf1de08980dd9d47043a40eb904120 /Doc/library
parent950840261c349e100ec5d7381fcd742c017e242d (diff)
downloadcpython-44d1a5912ea629aa20fdc377a5ab69d9ccf75d61.zip
cpython-44d1a5912ea629aa20fdc377a5ab69d9ccf75d61.tar.gz
cpython-44d1a5912ea629aa20fdc377a5ab69d9ccf75d61.tar.bz2
bpo-32250: Implement asyncio.current_task() and asyncio.all_tasks() (#4799)
Diffstat (limited to 'Doc/library')
-rw-r--r--Doc/library/asyncio-task.rst22
1 files changed, 22 insertions, 0 deletions
diff --git a/Doc/library/asyncio-task.rst b/Doc/library/asyncio-task.rst
index 72fae5e..d85dddf 100644
--- a/Doc/library/asyncio-task.rst
+++ b/Doc/library/asyncio-task.rst
@@ -528,6 +528,28 @@ Task functions
the event loop object used by the underlying task or coroutine. If it's
not provided, the default event loop is used.
+
+.. function:: current_task(loop=None):
+
+ Return the current running :class:`Task` instance or ``None``, if
+ no task is running.
+
+ If *loop* is ``None`` :func:`get_running_loop` is used to get
+ the current loop.
+
+ .. versionadded:: 3.7
+
+
+.. function:: all_tasks(loop=None):
+
+ Return a set of :class:`Task` objects created for the loop.
+
+ If *loop* is ``None`` :func:`get_event_loop` is used for getting
+ current loop.
+
+ .. versionadded:: 3.7
+
+
.. function:: as_completed(fs, \*, loop=None, timeout=None)
Return an iterator whose values, when waited for, are :class:`Future`