mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-22 00:00:11 +02:00
tokio: add support for signals up to SIGRTMAX (#4555)
The POSIX standard not only supports "reliable signals", but also "real-time signals". This commit adds support for the latter.
This commit is contained in:
@@ -237,7 +237,7 @@ mod tests {
|
||||
#[test]
|
||||
fn record_invalid_event_does_nothing() {
|
||||
let registry = Registry::new(vec![EventInfo::default()]);
|
||||
registry.record_event(42);
|
||||
registry.record_event(1302);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -22,13 +22,17 @@ use self::driver::Handle;
|
||||
|
||||
pub(crate) type OsStorage = Vec<SignalInfo>;
|
||||
|
||||
// Number of different unix signals
|
||||
// (FreeBSD has 33)
|
||||
const SIGNUM: usize = 33;
|
||||
|
||||
impl Init for OsStorage {
|
||||
fn init() -> Self {
|
||||
(0..SIGNUM).map(|_| SignalInfo::default()).collect()
|
||||
// There are reliable signals ranging from 1 to 33 available on every Unix platform.
|
||||
#[cfg(not(target_os = "linux"))]
|
||||
let possible = 0..=33;
|
||||
|
||||
// On Linux, there are additional real-time signals available.
|
||||
#[cfg(target_os = "linux")]
|
||||
let possible = 0..=libc::SIGRTMAX();
|
||||
|
||||
possible.map(|_| SignalInfo::default()).collect()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user