This module contains the implementation of Std.CancellationToken. Std.CancellationToken provides a
cancellation primitive for signaling cancellation between tasks or threads. It supports both synchronous
and asynchronous waiting, and is useful for cases where you want to notify one or more waiters
that a cancellation has occurred.
Reasons for cancellation.
- deadline : CancellationReason
Cancelled due to a deadline or timeout
- shutdown : CancellationReason
Cancelled due to shutdown
- cancel : CancellationReason
Explicitly cancelled
- custom
(msg : String)
: CancellationReason
Custom cancellation reason
Instances For
Equations
Instances For
Equations
Instances For
- normal (promise : IO.Promise Unit) : Consumer
- select (finished : Internal.IO.Async.Waiter Unit) : Consumer
Instances For
The central state structure for a CancellationToken.
- reason : Option CancellationReason
The cancellation reason if cancelled, none otherwise.
Consumers that are blocked waiting for cancellation. #
Instances For
A cancellation token is a synchronization primitive that allows multiple consumers to wait until cancellation is requested.
Instances For
Creates a new cancellation token.
Equations
Instances For
Cancels the token with the given reason, notifying all currently waiting consumers. Once cancelled, the token remains cancelled.
Equations
Instances For
Checks if the token is cancelled.
Equations
Instances For
Gets the cancellation reason if the token is cancelled.
Equations
Instances For
Waits for cancellation. Returns a task that completes when cancelled.
Equations
Instances For
Creates a selector that waits for cancellation.