Skip to content

Commit

Permalink
Clear poison on Mutex
Browse files Browse the repository at this point in the history
  • Loading branch information
MolotovCherry committed Feb 2, 2025
1 parent 1357e8e commit 2d27e2c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion crates/shared/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,11 @@ pub trait SuperLock<T> {
impl<T> SuperLock<T> for Mutex<T> {
/// Always get a mutex guard regardless of poison status
fn super_lock(&self) -> MutexGuard<T> {
self.clear_poison();

match self.lock() {
Ok(v) => v,
Err(p) => p.into_inner(),
Err(_) => unreachable!("poison was cleared; this is impossible"),
}
}
}
Expand Down

0 comments on commit 2d27e2c

Please sign in to comment.