[][src]Struct signal_stack::SignalHandlerGuard

pub struct SignalHandlerGuard<'a> { /* fields omitted */ }

This is the primary interface to the crate. When this guard is constructed a new signal handler for one or more signals is pushed onto the top of the stack.

When it is dropped, the signal handler will be removed from the stack. Signal handlers can be removed at any time, it need not be in reverse order, although that would typically be the case.

Implementations

impl<'a> SignalHandlerGuard<'a>[src]

pub unsafe fn new_unsafe(
    signums: &'a [c_int],
    handler: Arc<dyn Handler>
) -> Self
[src]

Add a new signal handler.

Safety

The handler function must be async-signal-safe, which places severe restrictions on what the function may do.

A non-exhaustive list of things that are not allowed:

  • Allocating or freeing memory.
  • Locking or unlocking mutexes or other kinds of concurrency primitive, with the exception of posting to a libc semaphore.
  • Calling a function which is not itself marked as async-signal-safe.
  • Performing any kind of blocking I/O.

pub fn new<H: SafeHandler>(signums: &'a [c_int], handler: H) -> Self[src]

Safely construct a signal guard from a function known statically to be async-signal-safe.

pub fn forget(self)[src]

Forget this signal guard: the handler will remain attached for the lifetime of the program.

Trait Implementations

impl<'a> Debug for SignalHandlerGuard<'a>[src]

impl<'a> Drop for SignalHandlerGuard<'a>[src]

Auto Trait Implementations

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.