summaryrefslogtreecommitdiffstats
path: root/tokio-signal/tests/drop_then_get_a_signal.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tokio-signal/tests/drop_then_get_a_signal.rs')
-rw-r--r--tokio-signal/tests/drop_then_get_a_signal.rs28
1 files changed, 28 insertions, 0 deletions
diff --git a/tokio-signal/tests/drop_then_get_a_signal.rs b/tokio-signal/tests/drop_then_get_a_signal.rs
new file mode 100644
index 00000000..4323e38b
--- /dev/null
+++ b/tokio-signal/tests/drop_then_get_a_signal.rs
@@ -0,0 +1,28 @@
+#![cfg(unix)]
+
+extern crate libc;
+
+pub mod support;
+use support::*;
+
+#[test]
+fn drop_then_get_a_signal() {
+ let mut lp = Core::new().unwrap();
+ let handle = lp.handle();
+
+ let signal = run_core_with_timeout(&mut lp, Signal::with_handle(
+ libc::SIGUSR1,
+ &handle.new_tokio_handle(),
+ )).expect("failed to create first signal");
+ drop(signal);
+
+ 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");
+}