Function block

Source
pub fn block(signals: &[Signal])
Expand description

Block all given signals without receiving notifications.

If a signal has also been passed to notify/notify_on this function does not have any effect in terms of that signal.

THIS MUST BE CALLED BEFORE ANY OTHER THREADS ARE SPAWNED IN YOUR PROCESS.

Examples found in repository?
examples/test_one_not_other.rs (line 9)
8fn main() {
9    block(&[Signal::TERM]);
10    let (s, r) = chan::sync(1);
11    chan_signal::notify_on(&s, Signal::HUP);
12    kill_this(Signal::TERM);
13    kill_this(Signal::HUP);
14    assert_eq!(r.recv(), Some(Signal::HUP));
15}