$ signal-hook

v0.4.4

Unix signal handling

Downloads: 147.5M
Recent: 32.5M
Versions: 46
Updated: April 4, 2026

Latest Update Summary

Crate

Name: signal-hook New version: 0.4.0 Release date: 2025-12-26T11:57:36.503727Z

Crate readme

Short description Library for safe and correct Unix signal handling in Rust.

Long description Unix signals are inherently hard to handle correctly due to their global nature and the limitations set by the POSIX standard on handling functions. This library provides a global registry of actions for signal arrival, allowing multiple actions for the same signal while enabling the removal of actions. Helper actions are also provided for common use cases in safe Rust.

Features • Safe Rust implementation • Global registry of signal actions • Register multiple actions for the same signal • Chaining of previous signal handlers

Code Examples Basic usage

 use std::io::Error;
use std::sync::Arc;
use std::sync::atomic::{AtomicBool, Ordering};

fn main() -> Result<(), Error> {
    let term = Arc::new(AtomicBool::new(false));
    signal_hook::flag::register(signal_hook::consts::SIGTERM, Arc::clone(&term))?;
    while !term.load(Ordering::Relaxed) {
        // Do some time-limited stuff here
    }
    Ok(())
}

Linkshttps://docs.rs/signal-hook

https://docs.rs/signal-hook

Release info

Release version: N/A

Release description N/A

Code Examples N/A

Patch update: 0.4.3 → 0.4.4

$ DOWNLOADS TREND

98.9M147.5M

$ VERSION HISTORY

v0.4.4April 4, 2026
v0.4.3January 24, 2026
v0.4.2January 24, 2026
v0.4.1December 26, 2025
v0.4.0December 26, 2025
v0.3.18May 9, 2025

$ LINKS

$ INSTALL

cargo add signal-hook

Or add to Cargo.toml: signal-hook = "0.4.4"