simple/simple.rs
1// This is a minimal example that demonstrates how to listen and respond to
2// OS signals. Namely, it requests to be notified about a SIGINT (usually
3// ^C in your terminal) and blocks until it gets one.
4
5#[macro_use] extern crate chan;
6extern crate chan_signal;
7
8use chan_signal::{Signal, notify};
9
10fn main() {
11 let signal = notify(&[Signal::INT]);
12 println!("Send a INT signal my way!");
13 // block until we get a signal
14 assert_eq!(signal.recv(), Some(Signal::INT));
15 println!("Thanks :]");
16}