Library
Module
Module type
Parameter
Class
Class type
A Canceler.t
is a three-states synchronization object with transitions "waiting -> canceling -> canceled", starting in waiting state. A chain of hooks can be attached to the canceler. Hooks are triggered when switching to the canceling state. The canceler switches to canceled state when the hooks have completed.
val create : unit -> t
create t
returns a canceler in waiting state.
If t
is in wait state, cancel t
triggers the cancellation process: 1. it switches to canceling state, 2. it executes the hooks sequentially in separate Lwt threads, 3. it waits for hooks execution to complete, 4. it switches to cancel state. If t
is in canceled state, cancel t
is determined immediately. If t
is in canceling state, cancel t
is determined at the end of the cancellation process.
cancellation t
is determined when t
is in canceling or canceled state.
on_cancel t hook
adds hook
to the end of the current chain.
val canceled : t -> bool
canceled t
is true
iff t
is canceled or canceling.