Files
tokio/tokio-signal/tests/dropping_does_not_deregister_other_instances.rs
T
Ivan PetkovandCarl Lerche cbad83f362 signal: migrate to std::futures (#1218)
Migrate to std::futures and the futures 0.3 preview and use async/await
where possible

**Breaking change:** the IoFuture and IoStream definitions used to refer
to Box<dyn Future> and Box<dyn Stream>, but now they are defined as
Pin<...> versions which are technically breaking.

No other breaking or functional changes have been made
2019-07-03 10:40:59 -07:00

31 lines
906 B
Rust

#![cfg(unix)]
#![deny(warnings, rust_2018_idioms)]
#![feature(async_await)]
use libc;
pub mod support;
use crate::support::*;
const TEST_SIGNAL: libc::c_int = libc::SIGUSR1;
#[tokio::test]
async fn dropping_signal_does_not_deregister_any_other_instances() {
// NB: Testing for issue #38: signals should not starve based on ordering
let first_duplicate_signal = with_timeout(Signal::new(TEST_SIGNAL))
.await
.expect("failed to register first duplicate signal");
let signal = with_timeout(Signal::new(TEST_SIGNAL))
.await
.expect("failed to register signal");
let second_duplicate_signal = with_timeout(Signal::new(TEST_SIGNAL))
.await
.expect("failed to register second duplicate signal");
drop(first_duplicate_signal);
drop(second_duplicate_signal);
send_signal(TEST_SIGNAL);
with_timeout(signal.into_future()).await;
}