Message_templates.ShutdownStructured shutdown protocol for graceful cleanup
This module provides a mechanism for registering cleanup handlers and executing them during application shutdown with configurable strategies including timeout protection.
Example:
let shutdown = Shutdown.create () in
(* Register cleanup handlers *)
Shutdown.register shutdown (fun () -> flush_pending_logs ());
(* Graceful shutdown with timeout *)
Shutdown.execute shutdown (Shutdown.Graceful 5.0)val create : unit -> tCreate a new shutdown controller
val register : t -> (unit -> unit) -> unitRegister a cleanup handler
Handlers are executed in reverse registration order (LIFO).
val execute : t -> shutdown_strategy -> unitExecute shutdown with specified strategy
val is_shutdown : t -> boolCheck if shutdown has been executed
val reset : t -> unitReset the shutdown controller (for testing)
Clears all handlers and resets shutdown state.