[−][src]Struct signal_stack::SignalHandlerGuard
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]
signums: &'a [c_int],
handler: Arc<dyn Handler>
) -> Self
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
impl<'a> !RefUnwindSafe for SignalHandlerGuard<'a>
[src]
impl<'a> Send for SignalHandlerGuard<'a>
[src]
impl<'a> Sync for SignalHandlerGuard<'a>
[src]
impl<'a> Unpin for SignalHandlerGuard<'a>
[src]
impl<'a> !UnwindSafe for SignalHandlerGuard<'a>
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,