impl<'a, T: 'a> LockTestExt<'a> for Mutex<T> {
#[inline]
fn held_by_thread(&self) -> LockHeldState {
- if self.lock().is_err() { return LockHeldState::HeldByThread; }
+ if self.inner.try_borrow_mut().is_err() { return LockHeldState::HeldByThread; }
else { return LockHeldState::NotHeldByThread; }
}
type ExclLock = MutexGuard<'a, T>;
impl<'a, T: 'a> LockTestExt<'a> for RwLock<T> {
#[inline]
fn held_by_thread(&self) -> LockHeldState {
- if self.write().is_err() { return LockHeldState::HeldByThread; }
+ if self.inner.try_borrow_mut().is_err() { return LockHeldState::HeldByThread; }
else { return LockHeldState::NotHeldByThread; }
}
type ExclLock = RwLockWriteGuard<'a, T>;