Skip to main content

SignalSystem

Trait SignalSystem 

Source
pub trait SignalSystem: Signals {
    // Required methods
    fn get_disposition(&self, signal: Number) -> Result<Disposition, Errno>;
    fn set_disposition(
        &self,
        signal: Number,
        disposition: Disposition,
    ) -> impl Future<Output = Result<Disposition, Errno>> + use<Self>;
}
Expand description

System interface for signal handling configuration

Required Methods§

Source

fn get_disposition(&self, signal: Number) -> Result<Disposition, Errno>

Returns the current disposition for a signal.

This function returns the current disposition for the specified signal like set_disposition does, but does not change the disposition.

Source

fn set_disposition( &self, signal: Number, disposition: Disposition, ) -> impl Future<Output = Result<Disposition, Errno>> + use<Self>

Sets how a signal is handled.

This function updates the signal blocking mask and the disposition for the specified signal, and returns the previous disposition.

The return type is a future so that virtual systems can simulate termination or suspension of the process that may be caused by a signal delivered as a result of changing the disposition.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<S> SignalSystem for Rc<Concurrent<S>>
where S: Sigmask + Sigaction,

Implementation of SignalSystem for Concurrent

Concurrent controls both the signal dispositions and the signal mask, so it can receive and handle signals without race conditions.

Source§

fn get_disposition(&self, signal: Number) -> Result<Disposition, Errno>

Returns the current disposition of the specified signal.

This implementation simply forwards the call to the inner system’s GetSigaction::get_sigaction method.

Source§

fn set_disposition( &self, signal: Number, disposition: Disposition, ) -> impl Future<Output = Result<Disposition, Errno>> + use<S>

Sets the disposition of the specified signal to the given value and returns the old disposition.

This implementation both updates the signal disposition and the signal mask to ensure that the select method can respond to received signals without race conditions. Specifically:

  • When setting the disposition to Default or Ignore, the signal is unblocked to allow it to be delivered as soon as possible.
  • When setting the disposition to Catch, the signal is blocked so that it is only delivered inside the select method.
Source§

impl<S: SignalSystem> SignalSystem for Rc<S>

Delegates the SignalSystem trait to the contained instance of S

Source§

fn get_disposition(&self, signal: Number) -> Result<Disposition, Errno>

Source§

fn set_disposition( &self, signal: Number, disposition: Disposition, ) -> impl Future<Output = Result<Disposition, Errno>> + use<S>

Implementors§