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

Improve deadlock detection output (#7515)

This commit is contained in:
Emil Ernerfeldt
2025-09-08 17:37:49 +02:00
committed by lucasmerlin
parent f49e44e9cc
commit 995b6a6ef5
3 changed files with 18 additions and 11 deletions

View File

@@ -101,7 +101,6 @@ impl BytesLoader for EhttpLoader {
{
let entry = entry.get_mut();
*entry = Poll::Ready(result);
ctx.request_repaint();
log::trace!("Finished loading {uri:?}");
true
} else {

View File

@@ -100,7 +100,6 @@ impl BytesLoader for FileLoader {
if let std::collections::hash_map::Entry::Occupied(mut entry) = cache.entry(uri.clone()) {
let entry = entry.get_mut();
*entry = Poll::Ready(result);
ctx.request_repaint();
log::trace!("Finished loading {uri:?}");
true
} else {

View File

@@ -30,9 +30,12 @@ mod mutex_impl {
#[cfg_attr(debug_assertions, track_caller)]
pub fn lock(&self) -> MutexGuard<'_, T> {
if cfg!(debug_assertions) {
self.0
.try_lock_for(DEADLOCK_DURATION)
.expect("Looks like a deadlock!")
self.0.try_lock_for(DEADLOCK_DURATION).unwrap_or_else(|| {
panic!(
"DEBUG PANIC: Failed to acquire Mutex after {}s. Deadlock?",
DEADLOCK_DURATION.as_secs()
)
})
} else {
self.0.lock()
}
@@ -161,9 +164,12 @@ mod rw_lock_impl {
#[cfg_attr(debug_assertions, track_caller)]
pub fn read(&self) -> RwLockReadGuard<'_, T> {
let guard = if cfg!(debug_assertions) {
self.0
.try_read_for(DEADLOCK_DURATION)
.expect("Looks like a deadlock!")
self.0.try_read_for(DEADLOCK_DURATION).unwrap_or_else(|| {
panic!(
"DEBUG PANIC: Failed to acquire RwLock read after {}s. Deadlock?",
DEADLOCK_DURATION.as_secs()
)
})
} else {
self.0.read()
};
@@ -174,9 +180,12 @@ mod rw_lock_impl {
#[cfg_attr(debug_assertions, track_caller)]
pub fn write(&self) -> RwLockWriteGuard<'_, T> {
let guard = if cfg!(debug_assertions) {
self.0
.try_write_for(DEADLOCK_DURATION)
.expect("Looks like a deadlock!")
self.0.try_write_for(DEADLOCK_DURATION).unwrap_or_else(|| {
panic!(
"DEBUG PANIC: Failed to acquire RwLock write after {}s. Deadlock?",
DEADLOCK_DURATION.as_secs()
)
})
} else {
self.0.write()
};