An open API service indexing awesome lists of open source software.

https://github.com/bells307/drop-panic

The callback that will be called if the current thread panics
https://github.com/bells307/drop-panic

panic rust

Last synced: 6 months ago
JSON representation

The callback that will be called if the current thread panics

Awesome Lists containing this project

README

          

# drop-panic

The callback that will be called if the current thread panics.

## Example
```rust
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));
```