Task::cancel
pub fn cancel() Import
Source: use task::{Task}; compiler/src/prelude/task.hy Asks the task to stop.
It unwinds at its next suspension point (at once, if it is suspended),
running its defer blocks, and join then returns Err(TaskError::Cancelled).
Cancelling a finished task does nothing. Code inside shield finishes first.
Called on a Task value as value.cancel(…).
See also#
Task::jointask::shieldTask: A handle to a child task started withScope::spawn.