Skip to content

Commit b17d716

Browse files
committed
Add track_caller to Mutex and RwLock for deadlock_detection
1 parent 94e92a0 commit b17d716

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

crates/epaint/src/mutex.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ mod mutex_impl {
2727
}
2828

2929
#[inline(always)]
30+
#[cfg_attr(debug_assertions, track_caller)]
3031
pub fn lock(&self) -> MutexGuard<'_, T> {
3132
if cfg!(debug_assertions) {
3233
self.0
@@ -157,6 +158,7 @@ mod rw_lock_impl {
157158

158159
impl<T: ?Sized> RwLock<T> {
159160
#[inline(always)]
161+
#[cfg_attr(debug_assertions, track_caller)]
160162
pub fn read(&self) -> RwLockReadGuard<'_, T> {
161163
let guard = if cfg!(debug_assertions) {
162164
self.0
@@ -169,6 +171,7 @@ mod rw_lock_impl {
169171
}
170172

171173
#[inline(always)]
174+
#[cfg_attr(debug_assertions, track_caller)]
172175
pub fn write(&self) -> RwLockWriteGuard<'_, T> {
173176
let guard = if cfg!(debug_assertions) {
174177
self.0

0 commit comments

Comments
 (0)