Crates.io | drop-panic |
lib.rs | drop-panic |
version | 0.1.0 |
source | src |
created_at | 2024-03-20 06:33:48.66332 |
updated_at | 2024-03-20 06:33:48.66332 |
description | The callback that will be called if the current thread panics |
homepage | |
repository | https://github.com/bells307/drop-panic |
max_upload_size | |
id | 1180026 |
size | 2,888 |
The callback that will be called if the current thread panics.
let panicked = Arc::new(AtomicBool::new(false));
let jh = thread::spawn({
let panicked = Arc::clone(&panicked);
move || {
drop_panic! {
panicked.store(true, Ordering::Release);
};
panic!("boom");
}
});
assert!(jh.join().is_err());
assert!(panicked.load(Ordering::Acquire));