install_sigint_stop_flag

Function install_sigint_stop_flag 

Source
pub fn install_sigint_stop_flag(stop: Arc<AtomicBool>) -> Result<()>
Expand description

Install a best-effort SIGINT (Ctrl-C) handler that sets stop to true.

This is intended for cooperative shutdown wiring in long-running processes.

Notes:

  • Unix only: on non-Unix targets this is a no-op that returns Ok(()).
  • This keeps the signal handler async-signal-safe by doing only an atomic store.
  • The stop flag is intentionally leaked to avoid use-after-free if SIGINT fires late.
  • This installs a single process-global stop flag. Calling it multiple times with different Arcs will leak one allocation per call; install once during startup.