Function notify

Source
pub fn notify(signal: &[Signal]) -> Receiver<Signal>
Examples found in repository?
examples/simple.rs (line 6)
5fn main() {
6    let rx = notify(&[Signal::INT, Signal::WINCH]);
7    println!("Waiting SIGINT and SIGWINCH...");
8    println!("got: {:?}", rx.recv().unwrap());
9}
More examples
Hide additional examples
examples/threads.rs (line 7)
6fn main() {
7    let rx = notify(&[Signal::INT]);
8    println!("Send 5 SIGINTs to kill this process");
9    thread::spawn(|| {
10        let rx = notify(&[Signal::INT]);
11        for sig in rx.iter().take(5) {
12            println!("in thread: {:?}", sig);
13        }
14        loop {
15            thread::sleep(::std::time::Duration::from_secs(10));
16        }
17    });
18    for sig in rx.iter().take(5) {
19        println!("main: {:?}", sig);
20    }
21}