> ## Documentation Index
> Fetch the complete documentation index at: https://aspect.build/llms.txt
> Use this file to discover all available pages before exploring further.

# Token

`function` **Token.cancel**

<pre language="python">
  `def Token.cancel() -> None`
</pre>

Cancel this token and every token derived from it, and wake every `wait()`. Every process bound to one of them starts its stop sequence. Cancelling `ctx.cancellation.root` ends the task as Ctrl+C would.

`function` **Token.child**

<pre language="python">
  `def Token.child() -> cancellation.Token`
</pre>

A token cancelled whenever this one is. Cancelling the child never affects this token. Bind a piece of work to a child to be able to stop just that piece: `sub = ctx.cancellation.root.child()`.

`function` **Token.wait**

<pre language="python">
  `def Token.wait(
  *,
  timeout_ms: None | int = None
  ) -> bool`
</pre>

Block until this token is cancelled, or `timeout_ms` passes. Returns `True` when it was cancelled, `False` on the timeout.

`property` **Token.cancelled**

<pre language="python">
  `Token.cancelled: bool`
</pre>

Whether this token has been cancelled, by `cancel()` on it or on an ancestor, or by the operating system for the root. What a loop checks on its tick.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.