mirror of
https://github.com/emilk/egui.git
synced 2026-08-31 05:40:03 -04:00
Add track_caller to Mutex and RwLock for deadlock_detection
This commit is contained in:
@@ -27,6 +27,7 @@ mod mutex_impl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
|
#[cfg_attr(debug_assertions, track_caller)]
|
||||||
pub fn lock(&self) -> MutexGuard<'_, T> {
|
pub fn lock(&self) -> MutexGuard<'_, T> {
|
||||||
if cfg!(debug_assertions) {
|
if cfg!(debug_assertions) {
|
||||||
self.0
|
self.0
|
||||||
@@ -157,6 +158,7 @@ mod rw_lock_impl {
|
|||||||
|
|
||||||
impl<T: ?Sized> RwLock<T> {
|
impl<T: ?Sized> RwLock<T> {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
|
#[cfg_attr(debug_assertions, track_caller)]
|
||||||
pub fn read(&self) -> RwLockReadGuard<'_, T> {
|
pub fn read(&self) -> RwLockReadGuard<'_, T> {
|
||||||
let guard = if cfg!(debug_assertions) {
|
let guard = if cfg!(debug_assertions) {
|
||||||
self.0
|
self.0
|
||||||
@@ -169,6 +171,7 @@ mod rw_lock_impl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
|
#[cfg_attr(debug_assertions, track_caller)]
|
||||||
pub fn write(&self) -> RwLockWriteGuard<'_, T> {
|
pub fn write(&self) -> RwLockWriteGuard<'_, T> {
|
||||||
let guard = if cfg!(debug_assertions) {
|
let guard = if cfg!(debug_assertions) {
|
||||||
self.0
|
self.0
|
||||||
|
|||||||
Reference in New Issue
Block a user