turn_off switch turns off the switch. It calls all registered hooks, waits for all of them to terminate, then returns. If one of the hooks failed, it will fail with the exception raised by the hook. If the switch is already off, it does nothing.
exceptionOff
Exception raised when trying to add a hook to a switch that is already off.
check switch does nothing if switch is None or contains an switch that is currently on, and raises Off otherwise.
val add_hook : t option->(unit ->unit Lwt.t)-> unit
add_hook switch f registers f so it will be called when turn_off is invoked. It does nothing if switch is None. If switch contains an switch that is already off then Off is raised.
val add_hook_or_exec : t option->(unit ->unit Lwt.t)->unit Lwt.t
add_hook_or_exec switch f is the same as add_hook except that if the switch is already off, f is called immediately.