Skip to main content

register_handler

Function register_handler 

Source
pub fn register_handler() -> Result<()>
Expand description

Registers SIGINT (and Unix SIGTERM) handlers that set cancellation flags.

Must be called once before any long-running operation and, on the binary path, before the Tokio multi-thread runtime is built (G-UNSAFE-13 / signal-hook first-hook race). Additional calls are safe and silently ignored (Once / idempotent).

ยงErrors

Returns an error if the first registration fails (e.g. ctrlc cannot install a handler). Failures are not ignored.