Imandrakit_sync.SwitchSwitch to cancel tasks.
A switch can be flipped to false once, and remains off forever afterwards.
val pp :
Ppx_deriving_runtime.Format.formatter ->
t ->
Ppx_deriving_runtime.unitval show : t -> Ppx_deriving_runtime.stringval with_on_turn_off : t -> (unit -> unit) -> (unit -> 'a) -> 'awith_on_turn_off sw cb f calls f(). Within the context where f() is running, sw turning off will trigger cb(). Once f() has terminated, cb is disabled and will not be called.
val on_turn_off : t -> (unit -> unit) -> uniton_turn_off sw f will call f() when sw is turned off. If sw is already off then f() is called immediately. NOTE f really should not fail.
val is_on : t -> boolval is_off : t -> boolval turn_off : ?trace:bool -> t -> unitval turn_off' : ?trace:bool -> t -> [ `Was_off | `Was_on ]Turn off switch, return previous state