sleep/sleep.rs
1#[macro_use] extern crate chan;
2extern crate chan_signal;
3
4use std::thread;
5use std::time::Duration;
6
7use chan_signal::{Signal, notify};
8
9fn main() {
10 let signal = notify(&[Signal::INT]);
11 println!("Send a INT signal my way!");
12 thread::spawn(move || thread::sleep(Duration::from_secs(10)));
13 // block until we get a signal
14 assert_eq!(signal.recv(), Some(Signal::INT));
15 println!("Thanks :]");
16}