tokio/tokio-net/tests/signal_twice.rs
Ivan Petkov 08b07afbd9
signal: remove new() constructors in favor of free functions (#1472)
* Also removed any `*_with_handle` related methods in favor of always
using the default reactor
2019-08-18 14:22:09 -07:00

23 lines
488 B
Rust

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