improve deadlock panic message

This commit is contained in:
Bryan Stitt 2023-07-06 15:03:02 -07:00
parent a8d2f3fe62
commit ac77b691df

View File

@ -97,16 +97,17 @@ fn main() -> anyhow::Result<()> {
continue; continue;
} }
println!("{} deadlocks detected", deadlocks.len()); let mut msg = format!("{} deadlocks detected\n", deadlocks.len());
for (i, threads) in deadlocks.iter().enumerate() { for (i, threads) in deadlocks.iter().enumerate() {
println!("Deadlock #{}", i); msg += &format!("Deadlock #{}", i);
for t in threads { for t in threads {
println!("Thread Id {:#?}", t.thread_id()); msg += &format!("Thread Id {:#?}\n", t.thread_id());
println!("{:#?}", t.backtrace()); msg += &format!("{:#?}\n", t.backtrace());
} }
} }
panic!("deadlock detected!"); panic!("{:#}", msg);
}); });
} }