1 | #![warn (rust_2018_idioms)] |
2 | #![cfg (feature = "full" )] |
3 | #![cfg (unix)] |
4 | |
5 | mod support { |
6 | pub mod signal; |
7 | } |
8 | use support::signal::send_signal; |
9 | |
10 | use tokio::signal::unix::{signal, SignalKind}; |
11 | |
12 | #[tokio::test ] |
13 | async fn dropping_signal_does_not_deregister_any_other_instances() { |
14 | let kind = SignalKind::user_defined1(); |
15 | |
16 | // Signals should not starve based on ordering |
17 | let first_duplicate_signal = signal(kind).expect("failed to register first duplicate signal" ); |
18 | let mut sig = signal(kind).expect("failed to register signal" ); |
19 | let second_duplicate_signal = signal(kind).expect("failed to register second duplicate signal" ); |
20 | |
21 | drop(first_duplicate_signal); |
22 | drop(second_duplicate_signal); |
23 | |
24 | send_signal(libc::SIGUSR1); |
25 | let _ = sig.recv().await; |
26 | } |
27 | |