8个版本
| 0.3.3 | 2023年5月12日 | 
|---|---|
| 0.3.2 | 2023年5月10日 | 
| 0.3.1 | 2023年4月26日 | 
| 0.2.0 | 2023年4月25日 | 
| 0.1.1 | 2022年1月3日 | 
#992 in Rust模式
用于 daemon_ctrl
7KB
will_exit
用法
use core::time::Duration;
use std::thread;
fn main() {
    will_exit::init(2000).unwrap();
    std::panic::set_hook(Box::new(|info| {
        println!("{}", info);
        will_exit::exit(-1);
    }));
    thread::spawn(|| {
        thread::sleep(Duration::from_secs(6));
        will_exit::exit();
    });
    loop {
        if will_exit::will_exit() {
            break;
        }
        thread::sleep(Duration::from_millis(100));
    }
    println!("exit");
}
依赖项
~115KB