We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent dac2cef commit 7e25c26Copy full SHA for 7e25c26
Doc/library/asyncio-task.rst
@@ -359,6 +359,14 @@ and reliable way to wait for all tasks in the group to finish.
359
:meth:`cancel` is idempotent and may be called after the task group has
360
already exited.
361
362
+ Ways to use :meth:`cancel`:
363
+ * call it from the task group body based on some condition or
364
+ event
365
+ * pass the task group instance to child tasks via :meth:`create_task`,
366
+ allowing a child task to conditionally cancel the entire entire group
367
+ * pass the task group instance or bound :meth:`cancel` method to some
368
+ other task *before* opening the task group, allowing remote cancellation
369
+
370
.. versionadded:: next
371
372
Example::
0 commit comments