1
0
mirror of https://github.com/emilk/egui.git synced 2026-06-26 22:53:14 -04:00

Panic mutexes that can't lock for 30 seconds, in debug builds (#7468)

I'm trying to debug a suspected deadlock in the CI for
https://github.com/emilk/egui/pull/7467

Since we use our own mutex wrappers, we can just panic if the lock is
too slow. Ugly and effective :)
This commit is contained in:
Emil Ernerfeldt
2025-08-21 15:31:56 +02:00
committed by lucasmerlin
parent 18dc9dcff4
commit 0ddcc85f0c

View File

@@ -23,7 +23,13 @@ mod mutex_impl {
#[inline(always)]
pub fn lock(&self) -> MutexGuard<'_, T> {
self.0.lock()
if cfg!(debug_assertions) {
self.0
.try_lock_for(std::time::Duration::from_secs(30))
.expect("Looks like a deadlock!")
} else {
self.0.lock()
}
}
}
}