#signal #unix

uninterruptible

Guard type that keeps selected Unix signals suppressed

1 unstable release

0.1.0 Apr 12, 2021

#48 in #signal

22 downloads per month
Used in 2 crates (via cotton)

MIT license

5KB

Latest Version Documentation License

Guard type that keeps selected Unix signals suppressed.

use uninterruptible::Uninterruptible;

// catch terminate signals (SIGTERM, SIGQUIT, SIGINT)
let u = Uninterruptible::terminate()?;

// do work, e.g. call in sub-process

u.checkpoint()?; // fails if the process recived one of the terminate signals (e.g. CTRL-C was pressed)


drop(u); // revert to default signal handlers

See module level documentation on docs.rs for more examples.


lib.rs:

Guard type that keeps selected Unix signals suppressed.

use uninterruptible::Uninterruptible;

// catch terminate signals (SIGTERM, SIGQUIT, SIGINT)
let u = Uninterruptible::terminate().unwrap();

// do work, e.g. call in sub-process

u.checkpoint().unwrap(); // fails if the process recived one of the terminate signals (e.g. CTRL-C was pressed)


drop(u); // revert to default signal handlers

Dependencies

~115KB

.t`