2 // ignore-emscripten no threads support
4 use std::sync::atomic::{AtomicUsize, Ordering, ATOMIC_USIZE_INIT};
8 static A: AtomicUsize = ATOMIC_USIZE_INIT;
11 panic::set_hook(Box::new(|_| {
12 A.fetch_add(1, Ordering::SeqCst);
15 let result = thread::spawn(|| {
16 let result = panic::catch_unwind(|| {
20 panic::resume_unwind(result.unwrap_err());
23 let msg = *result.unwrap_err().downcast::<&'static str>().unwrap();
24 assert_eq!("hi there", msg);
25 assert_eq!(1, A.load(Ordering::SeqCst));