Struct async_signal::Signals
source · pub struct Signals { /* private fields */ }
Expand description
Wait for a specific set of signals.
See the module-level documentation for more details.
Implementations§
source§impl Signals
impl Signals
sourcepub fn new<B>(signals: impl IntoIterator<Item = B>) -> Result<Self>
pub fn new<B>(signals: impl IntoIterator<Item = B>) -> Result<Self>
Create a new Signals
instance with a set of signals.
sourcepub fn add_signals<B>(
&mut self,
signals: impl IntoIterator<Item = B>,
) -> Result<()>
pub fn add_signals<B>( &mut self, signals: impl IntoIterator<Item = B>, ) -> Result<()>
Add signals to the set of signals to wait for.
One signal cannot be added twice. If a signal that has already been added is passed to this method, it will be ignored.
Registering a signal prevents the default behavior of that signal from occurring. For
example, if you register SIGINT
, pressing Ctrl+C
will no longer terminate the process.
To run the default signal handler, use signal_hook::low_level::emulate_default_handler
instead.
sourcepub fn remove_signals<B>(
&mut self,
signals: impl IntoIterator<Item = B>,
) -> Result<()>
pub fn remove_signals<B>( &mut self, signals: impl IntoIterator<Item = B>, ) -> Result<()>
Remove signals from the set of signals to wait for.
This function can be used to opt out of listening to signals previously registered via
add_signals
or new
. If a signal that has not been
registered is passed to this method, it will be ignored.