Files
tokio/tests/drop_then_get_a_signal.rs
T

29 lines
710 B
Rust
Raw Normal View History

#![cfg(unix)]
extern crate libc;
2018-07-28 12:30:46 -07:00
pub mod support;
use support::*;
#[test]
fn drop_then_get_a_signal() {
let mut lp = Core::new().unwrap();
let handle = lp.handle();
2018-07-28 12:30:46 -07:00
let signal = run_core_with_timeout(&mut lp, Signal::with_handle(
libc::SIGUSR1,
&handle.new_tokio_handle(),
2018-07-28 12:30:46 -07:00
)).expect("failed to create first signal");
drop(signal);
2018-07-28 12:30:46 -07:00
send_signal(libc::SIGUSR1);
let signal = lp.run(Signal::with_handle(libc::SIGUSR1, &handle.new_tokio_handle()))
.expect("failed to create signal")
.into_future()
.map(|_| ())
.map_err(|(e, _)| panic!("{}", e));
run_core_with_timeout(&mut lp, signal)
.expect("failed to get signal");
}