Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
22dd8334
Commit
22dd8334
authored
Sep 24, 2014
by
R David Murray
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve English phrasing in asyncio task docs.
parent
f8c111d4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
9 deletions
+9
-9
Doc/library/asyncio-task.rst
Doc/library/asyncio-task.rst
+9
-9
No files found.
Doc/library/asyncio-task.rst
View file @
22dd8334
...
@@ -319,18 +319,18 @@ Task
...
@@ -319,18 +319,18 @@ Task
Schedule the execution of a :ref:`coroutine <coroutine>`: wrap it in a
Schedule the execution of a :ref:`coroutine <coroutine>`: wrap it in a
future. A task is a subclass of :class:`Future`.
future. A task is a subclass of :class:`Future`.
A task is responsible
to execute
a coroutine object in an event loop. If
A task is responsible
for executing
a coroutine object in an event loop. If
the wrapped coroutine yields from a future, the task suspends the execution
the wrapped coroutine yields from a future, the task suspends the execution
of the wrapped coroutine and waits for the completition of the future. When
of the wrapped coroutine and waits for the completition of the future. When
the future is done, the execution of the wrapped coroutine restarts with the
the future is done, the execution of the wrapped coroutine restarts with the
result or the exception of the future.
result or the exception of the future.
Event loops use cooperative scheduling: an event loop only runs one task at
Event loops use cooperative scheduling: an event loop only runs one task at
the same
time. Other tasks may run in parallel if other event loops are
a
time. Other tasks may run in parallel if other event loops are
running in different threads. While a task waits for the completion of a
running in different threads. While a task waits for the completion of a
future, the event loop executes a new task.
future, the event loop executes a new task.
The cancellation of a task is different
than cancelling
a future. Calling
The cancellation of a task is different
from the cancelation of
a future. Calling
:meth:`cancel` will throw a :exc:`~concurrent.futures.CancelledError` to the
:meth:`cancel` will throw a :exc:`~concurrent.futures.CancelledError` to the
wrapped coroutine. :meth:`~Future.cancelled` only returns ``True`` if the
wrapped coroutine. :meth:`~Future.cancelled` only returns ``True`` if the
wrapped coroutine did not catch the
wrapped coroutine did not catch the
...
@@ -341,7 +341,7 @@ Task
...
@@ -341,7 +341,7 @@ Task
<coroutine>` did not complete. It is probably a bug and a warning is
<coroutine>` did not complete. It is probably a bug and a warning is
logged: see :ref:`Pending task destroyed <asyncio-pending-task-destroyed>`.
logged: see :ref:`Pending task destroyed <asyncio-pending-task-destroyed>`.
Don't
create directly
:class:`Task` instances: use the :func:`async`
Don't
directly create
:class:`Task` instances: use the :func:`async`
function or the :meth:`BaseEventLoop.create_task` method.
function or the :meth:`BaseEventLoop.create_task` method.
.. classmethod:: all_tasks(loop=None)
.. classmethod:: all_tasks(loop=None)
...
@@ -360,17 +360,17 @@ Task
...
@@ -360,17 +360,17 @@ Task
.. method:: cancel()
.. method:: cancel()
Request th
is task to
cancel itself.
Request th
at this task
cancel itself.
This arranges for a :exc:`~concurrent.futures.CancelledError` to be
This arranges for a :exc:`~concurrent.futures.CancelledError` to be
thrown into the wrapped coroutine on the next cycle through the event
thrown into the wrapped coroutine on the next cycle through the event
loop. The coroutine then has a chance to clean up or even deny the
loop. The coroutine then has a chance to clean up or even deny the
request using try/except/finally.
request using try/except/finally.
Contrary to
:meth:`Future.cancel`, this does not guarantee that the task
Unlike
:meth:`Future.cancel`, this does not guarantee that the task
will be cancelled: the exception might be caught and acted upon, delaying
will be cancelled: the exception might be caught and acted upon, delaying
cancellation of the task or preventing
it completely. The task may also
cancellation of the task or preventing
cancellation completely. The task
return a value or raise a different exception.
may also
return a value or raise a different exception.
Immediately after this method is called, :meth:`~Future.cancelled` will
Immediately after this method is called, :meth:`~Future.cancelled` will
not return ``True`` (unless the task was already cancelled). A task will
not return ``True`` (unless the task was already cancelled). A task will
...
@@ -405,7 +405,7 @@ Task
...
@@ -405,7 +405,7 @@ Task
This produces output similar to that of the traceback module, for the
This produces output similar to that of the traceback module, for the
frames retrieved by get_stack(). The limit argument is passed to
frames retrieved by get_stack(). The limit argument is passed to
get_stack(). The file argument is an I/O stream to which the output
get_stack(). The file argument is an I/O stream to which the output
goes; by default it goes
to sys.stderr.
is written; by default output is written
to sys.stderr.
Example: Parallel execution of tasks
Example: Parallel execution of tasks
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment