[][src]Struct scoped_signal::SignalScope

pub struct SignalScope<F> { /* fields omitted */ }

Install a signal handler only valid for a given scope

Methods

impl<Handler: Fn(u8, &SigInfo)> SignalScope<Handler>[src]

pub unsafe fn new(
    signal: Signal,
    flags: SaFlags,
    set: SigSet,
    handler: Handler
) -> Self
[src]

Create an object representing the provided signal handler. The handler is only called in the thread that run() is called from. If another thread receives the same signal, the signal will be ignored unless the thread is using its own SignalScope for the same signal

set defines what signals are blocked during the execution of the signal handler itself

See sigaction(3P) for more info

Safety

This is an unsafe operation because the passed handler must only call async-signal-safe functions and we cannot verify this

pub fn run<T, F: FnOnce() -> T>(self, f: F) -> Result<T, Error>[src]

Run the given closure with this signal handler installed

Auto Trait Implementations

impl<F> RefUnwindSafe for SignalScope<F> where
    F: RefUnwindSafe

impl<F> Send for SignalScope<F> where
    F: Send

impl<F> Sync for SignalScope<F> where
    F: Sync

impl<F> Unpin for SignalScope<F> where
    F: Unpin

impl<F> UnwindSafe for SignalScope<F> where
    F: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.