summaryrefslogtreecommitdiffstats
path: root/Doc/library/asyncio-task.rst
diff options
context:
space:
mode:
Diffstat (limited to 'Doc/library/asyncio-task.rst')
-rw-r--r--Doc/library/asyncio-task.rst12
1 files changed, 9 insertions, 3 deletions
diff --git a/Doc/library/asyncio-task.rst b/Doc/library/asyncio-task.rst
index 3008c86..158a0d8 100644
--- a/Doc/library/asyncio-task.rst
+++ b/Doc/library/asyncio-task.rst
@@ -209,6 +209,8 @@ Future
:func:`~concurrent.futures.as_completed` functions in the
:mod:`concurrent.futures` package.
+ This class is :ref:`not thread safe <asyncio-multithreading>`.
+
.. method:: cancel()
Cancel the future and schedule callbacks.
@@ -375,6 +377,8 @@ Task
Don't directly create :class:`Task` instances: use the :func:`async`
function or the :meth:`BaseEventLoop.create_task` method.
+ This class is :ref:`not thread safe <asyncio-multithreading>`.
+
.. classmethod:: all_tasks(loop=None)
Return a set of all tasks for an event loop.
@@ -545,7 +549,7 @@ Task functions
Return ``True`` if *func* is a decorated :ref:`coroutine function
<coroutine>`.
-.. function:: sleep(delay, result=None, \*, loop=None)
+.. coroutinefunction:: sleep(delay, result=None, \*, loop=None)
Create a :ref:`coroutine <coroutine>` that completes after a given
time (in seconds). If *result* is provided, it is produced to the caller
@@ -554,6 +558,8 @@ Task functions
The resolution of the sleep depends on the :ref:`granularity of the event
loop <asyncio-delayed-calls>`.
+ This function is a :ref:`coroutine <coroutine>`.
+
.. function:: shield(arg, \*, loop=None)
Wait for a future, shielding it from cancellation.
@@ -581,7 +587,7 @@ Task functions
except CancelledError:
res = None
-.. function:: wait(futures, \*, loop=None, timeout=None, return_when=ALL_COMPLETED)
+.. coroutinefunction:: wait(futures, \*, loop=None, timeout=None, return_when=ALL_COMPLETED)
Wait for the Futures and coroutine objects given by the sequence *futures*
to complete. Coroutines will be wrapped in Tasks. Returns two sets of
@@ -626,7 +632,7 @@ Task functions
when the timeout occurs are returned in the second set.
-.. function:: wait_for(fut, timeout, \*, loop=None)
+.. coroutinefunction:: wait_for(fut, timeout, \*, loop=None)
Wait for the single :class:`Future` or :ref:`coroutine object <coroutine>`
to complete with timeout. If *timeout* is ``None``, block until the future