pub fn notify(signal: &[Signal]) -> Receiver<Signal>
Examples found in repository?
More 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}