diff --git a/src/ext/rw_lock.rs b/src/ext/rw_lock.rs index 63a974f..f14bbfb 100644 --- a/src/ext/rw_lock.rs +++ b/src/ext/rw_lock.rs @@ -14,6 +14,9 @@ impl GetRwLock for RwLock { type Target = T; fn get_ref<'a>(&'a self) -> RwLockReadGuard<'a, Self::Target> { loop { + if self.is_poisoned() { + panic!("Target is poisoned."); + } match self.try_read() { Ok(f) => { return f; @@ -26,6 +29,9 @@ impl GetRwLock for RwLock { } fn get_mut<'a>(&'a self) -> RwLockWriteGuard<'a, Self::Target> { loop { + if self.is_poisoned() { + panic!("Target is poisoned."); + } match self.try_write() { Ok(f) => { return f;