mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-24 00:00:11 +02:00
signal: Start adding windows support
This commit is contained in:
committed by
Carl Lerche
parent
1b6893b6f6
commit
8291c3d462
@@ -0,0 +1,17 @@
|
||||
extern crate futures;
|
||||
extern crate tokio_core;
|
||||
extern crate tokio_signal;
|
||||
|
||||
use futures::stream::Stream;
|
||||
use tokio_core::reactor::Core;
|
||||
|
||||
fn main() {
|
||||
let mut core = Core::new().unwrap();
|
||||
let ctrlc = tokio_signal::ctrl_c(&core.handle());
|
||||
let stream = core.run(ctrlc).unwrap();
|
||||
|
||||
core.run(stream.for_each(|()| {
|
||||
println!("Ctrl-C received!");
|
||||
Ok(())
|
||||
})).unwrap();
|
||||
}
|
||||
Reference in New Issue
Block a user