base/base.rs
1use core::time::Duration;
2use std::thread;
3
4fn main() {
5 will_exit::init(2000).unwrap();
6 std::panic::set_hook(Box::new(|info| {
7 println!("{}", info);
8 will_exit::exit(-1);
9 }));
10
11 thread::spawn(|| {
12 thread::sleep(Duration::from_secs(6));
13 will_exit::exit(0);
14 });
15 loop {
16 if will_exit::will_exit() {
17 break;
18 }
19 thread::sleep(Duration::from_millis(100));
20 }
21 println!("exit");
22}