Files
tokio/tokio-signal/tests/twice.rs
T
Ivan Petkov d9688bc094 signal: change unix::Signal to return () instead of signum (#1330)
* This simplifies the API surface by returning () instead of the signal
number that was used during registration. This also more closely mirrors
the cross-platform `CtrlC` event stream API
* This is a **breaking change**
2019-07-20 15:12:53 -07:00

25 lines
474 B
Rust

#![cfg(unix)]
#![deny(warnings, rust_2018_idioms)]
#![feature(async_await)]
pub mod support;
use crate::support::*;
use libc;
#[tokio::test]
async fn twice() {
let mut signal = with_timeout(Signal::new(libc::SIGUSR1))
.await
.expect("failed to get signal");
for _ in 0..2 {
send_signal(libc::SIGUSR1);
let (item, sig) = with_timeout(signal.into_future()).await;
assert_eq!(item, Some(()));
signal = sig;
}
}