mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-24 00:00:11 +02:00
signal: Run rustfmt 0.4.2
This commit is contained in:
committed by
Carl Lerche
parent
7a24ed7509
commit
2848df9b6c
@@ -2,9 +2,9 @@ extern crate futures;
|
||||
extern crate tokio_core;
|
||||
extern crate tokio_signal;
|
||||
|
||||
use futures::{Stream, Future};
|
||||
use futures::{Future, Stream};
|
||||
use tokio_core::reactor::Core;
|
||||
use tokio_signal::unix::{Signal,SIGHUP};
|
||||
use tokio_signal::unix::{Signal, SIGHUP};
|
||||
|
||||
fn main() {
|
||||
// set up a Tokio event loop
|
||||
@@ -14,16 +14,21 @@ fn main() {
|
||||
let stream = Signal::new(SIGHUP, &core.handle()).flatten_stream();
|
||||
|
||||
println!("Waiting for SIGHUPS (Ctrl+C to quit)");
|
||||
println!(" TIP: use `pkill -sighup sighup-example` from a second terminal \
|
||||
to send a SIGHUP to all processes named 'sighup-example' \
|
||||
(i.e. this binary)");
|
||||
println!(
|
||||
" TIP: use `pkill -sighup sighup-example` from a second terminal \
|
||||
to send a SIGHUP to all processes named 'sighup-example' \
|
||||
(i.e. this binary)"
|
||||
);
|
||||
|
||||
// for_each is a powerful primitive provided by the Futures crate
|
||||
// it turns a Stream into a Future that completes after all stream-items
|
||||
// have been completed.
|
||||
let future = stream.for_each(|the_signal| {
|
||||
println!("*Got signal {:#x}* I should probably reload my config \
|
||||
or something", the_signal);
|
||||
println!(
|
||||
"*Got signal {:#x}* I should probably reload my config \
|
||||
or something",
|
||||
the_signal
|
||||
);
|
||||
Ok(())
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user