mirror of
https://github.com/tokio-rs/tokio.git
synced 2025-09-28 12:10:37 +00:00

This avoids having consumers import libc for common signals, and it improves discoverability since users need not be aware that libc contains all supported constants.
20 lines
469 B
Rust
20 lines
469 B
Rust
#![cfg(unix)]
|
|
#![warn(rust_2018_idioms)]
|
|
#![feature(async_await)]
|
|
|
|
pub mod support;
|
|
use crate::support::*;
|
|
|
|
use libc;
|
|
|
|
#[tokio::test]
|
|
async fn notify_both() {
|
|
let kind = SignalKind::sigusr2();
|
|
let signal1 = Signal::new(kind).expect("failed to create signal1");
|
|
|
|
let signal2 = Signal::new(kind).expect("failed to create signal2");
|
|
|
|
send_signal(libc::SIGUSR2);
|
|
let _ = with_timeout(future::join(signal1.into_future(), signal2.into_future())).await;
|
|
}
|