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

Add track_caller to Mutex and RwLock for deadlock_detection

This commit is contained in:
lucasmerlin
2025-09-04 14:32:14 +02:00
parent 94e92a0697
commit b17d716cdb

View File

@@ -27,6 +27,7 @@ mod mutex_impl {
}
#[inline(always)]
#[cfg_attr(debug_assertions, track_caller)]
pub fn lock(&self) -> MutexGuard<'_, T> {
if cfg!(debug_assertions) {
self.0
@@ -157,6 +158,7 @@ mod rw_lock_impl {
impl<T: ?Sized> RwLock<T> {
#[inline(always)]
#[cfg_attr(debug_assertions, track_caller)]
pub fn read(&self) -> RwLockReadGuard<'_, T> {
let guard = if cfg!(debug_assertions) {
self.0
@@ -169,6 +171,7 @@ mod rw_lock_impl {
}
#[inline(always)]
#[cfg_attr(debug_assertions, track_caller)]
pub fn write(&self) -> RwLockWriteGuard<'_, T> {
let guard = if cfg!(debug_assertions) {
self.0