signal: refactor: Prefer the implicit handle passing used by tokio

This commit is contained in:
Markus Westerlind
2018-09-10 11:30:03 -07:00
committed by Carl Lerche
parent 209232befd
commit e73b8a0cc9
8 changed files with 93 additions and 50 deletions
+2 -4
View File
@@ -10,12 +10,10 @@ use tokio_signal::unix::{Signal, SIGINT, SIGTERM};
fn main() {
let mut core = Core::new().unwrap();
let handle = core.handle();
let handle = handle.new_tokio_handle();
// Create a stream for each of the signals we'd like to handle.
let sigint = Signal::new(SIGINT, &handle).flatten_stream();
let sigterm = Signal::new(SIGTERM, &handle).flatten_stream();
let sigint = Signal::new(SIGINT).flatten_stream();
let sigterm = Signal::new(SIGTERM).flatten_stream();
// Use the `select` combinator to merge these two streams into one
let stream = sigint.select(sigterm);