Skip to main content
function Cancellation.new
def Cancellation.new() -> cancellation.Token
A token nothing cancels but you. Bind a process to it to keep it out of Ctrl+C and stop it yourself, with cancel() on the token or interrupt(), terminate() and kill() on the handle. property Cancellation.root
Cancellation.root: cancellation.Token
The run’s root token. The operating system cancels it on Ctrl+C or SIGTERM; root.cancel() does the same from AXL. Every process spawned without an explicit cancellation = is bound to it and stops when it is cancelled. The task itself keeps running: read root.cancelled on a tick to end on your own terms, or let your waits return as the children stop. A task still running at the deadline is ended with exit 130 (143 for SIGTERM), its post-task hooks, ctx.defer callbacks and bookend intact.