signal_hook_registry

Function unregister

Source
pub fn unregister(id: SigId) -> bool
Expand description

Removes a previously installed action.

This function does nothing if the action was already removed. It returns true if it was removed and false if the action wasn’t found.

It can unregister all the actions installed by register as well as the ones from downstream crates (like signal-hook).

§Warning

This does not currently return the default/previous signal handler if the last action for a signal was just unregistered. That means that if you replaced for example SIGTERM and then removed the action, the program will effectively ignore SIGTERM signals from now on, not terminate on them as is the default action. This is OK if you remove it as part of a shutdown, but it is not recommended to remove termination actions during the normal runtime of application (unless the desired effect is to create something that can be terminated only by SIGKILL).