vorner/signal-hook ↗
Created Dec 28, 2020 · View the vorner/signal-hook repository page
Rust library allowing to register multiple handlers for the same signal
Want this for your repo?
Render a free sample of any GitHub repo in seconds.
Contributors
10
Lines of Code
490
From
Jun 13, 2018
To
Dec 26, 2020
About vorner/signal-hook
Signal-hook is a Rust library that provides safe and correct Unix signal handling by maintaining a global registry where applications can register multiple handlers for the same signal. Unix signals are notoriously difficult to handle correctly because they are a global resource shared across all libraries in a process, can interrupt execution from any thread at unpredictable times, and are constrained by POSIX restrictions on which functions are safe to call within a signal handler context.
The library solves these problems by allowing developers to register and later remove individual signal actions without disturbing handlers from other libraries or losing the ability to chain with previously installed handlers. It abstracts away the complexity of async-signal-safety by providing a global action registry that isolates signal handling logic from the unsafe constraints of raw signal handlers, making common signal handling patterns accessible from safe Rust code.
The library is dual-licensed under Apache 2.0 and MIT licenses, comes with comprehensive documentation, and includes support for common use cases through built-in helper actions beyond basic arbitrary action registration.