pub struct SignalActions { /* private fields */ }Expand description
Saved dispositions for an explicitly selected set of Unix signals.
Actions are process-global. The caller must exclusively coordinate changes to
these signals for the guard’s whole lifetime, restore overlapping guards in
reverse installation order, and supply an async-signal-safe static handler.
This guard chooses no signals, flags, cancellation, threads or shutdown policy.
Drop attempts restoration; call Self::restore to observe native failures.
Implementations§
Source§impl SignalActions
impl SignalActions
Sourcepub unsafe fn install(
signals: &[c_int],
handler: extern "C" fn(c_int),
) -> Result<Self, SignalActionError>
pub unsafe fn install( signals: &[c_int], handler: extern "C" fn(c_int), ) -> Result<Self, SignalActionError>
Install the same caller-supplied handler for each selected signal.
The handler uses an empty additional mask and no optional action flags. Empty selection has no effects. Duplicate signals refuse before native effects; failed installation attempts rollback of earlier changes.
§Errors
Returns the original installation failure separately from a rollback error.
§Safety
The caller must supply an async-signal-safe handler and exclusively coordinate process-global changes to the selected dispositions through restoration/Drop, including reverse-order restoration of overlapping guards.
Sourcepub fn restore(&mut self) -> Result<()>
pub fn restore(&mut self) -> Result<()>
Restore all saved dispositions in reverse order, retaining failures for retry.
Successful restoration is idempotent. Every saved action is attempted even if another fails; Drop makes one further best-effort attempt for failures.
§Errors
Returns the first native restoration failure.