Skip to main content

Signals

Trait Signals 

Source
pub trait Signals: Send + Sync {
    type Signal: Copy + Send + 'static;
    type Subscription: Send + 'static;

    // Required method
    fn signal_subscribe<Target>(
        &self,
        signals: &[Self::Signal],
        target: Target,
    ) -> Result<Self::Subscription>
       where Target: Notify<Self::Signal> + 'static;
}
Expand description

Explicit signal subscriptions provided by a scheduler.

This optional capability is separate from cancellation. A destination can request cancellation, enqueue the signal, or implement application policy. Backends implement this capability only where signal delivery is supported. This interface does not install signal handlers or select signal numbers.

Required Associated Types§

Source

type Signal: Copy + Send + 'static

A backend’s signal identifier; Unix implementations use c_int.

Source

type Subscription: Send + 'static

Owns one subscription. Dropping it stops admission of notifications; dispatch already in progress may finish and must retain its destination. Drop does not wait for callbacks or asynchronous backend cleanup.

Required Methods§

Source

fn signal_subscribe<Target>( &self, signals: &[Self::Signal], target: Target, ) -> Result<Self::Subscription>
where Target: Notify<Self::Signal> + 'static,

Subscribe synchronously, returning a guard that must remain alive while notifications are wanted. Setup failures are returned before success.

Callbacks run outside raw signal handlers and scheduler locks. Multiple subscriptions are independent. Signals may coalesce before delivery; this is not an exact counter or a globally ordered stream of OS events.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§