1个不稳定版本

0.1.0 2021年4月12日

#840 in Unix API


3个crates中使用(通过cotton

MIT许可证

6KB

Latest Version Documentation License

用于保持选定Unix信号抑制的守卫类型。

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

更多示例,请参阅docs.rs上的模块级文档。


lib.rs:

用于保持选定Unix信号抑制的守卫类型。

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

依赖

~200KB