summaryrefslogtreecommitdiff
path: root/src/mutex
diff options
context:
space:
mode:
Diffstat (limited to 'src/mutex')
-rw-r--r--src/mutex/mutex.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/mutex/mutex.rs b/src/mutex/mutex.rs
index 89dfef9..d5f7f3a 100644
--- a/src/mutex/mutex.rs
+++ b/src/mutex/mutex.rs
@@ -199,6 +199,11 @@ impl<T: ?Sized, R: RawMutex> Mutex<T, R> {
}
}
+ /// Returns `true` if the mutex is currently locked
+ pub(crate) fn is_locked(&self) -> bool {
+ self.raw.is_locked()
+ }
+
/// Lock without a [`ThreadKey`]. It is undefined behavior to do this without
/// owning the [`ThreadKey`].
pub(crate) unsafe fn try_lock_no_key(&self) -> Option<MutexRef<'_, T, R>> {