Skip to main content

RwLockExt

Trait RwLockExt 

Source
pub trait RwLockExt<T> {
    // Required methods
    fn read_or_recover(&self) -> RwLockReadGuard<'_, T>;
    fn write_or_recover(&self) -> RwLockWriteGuard<'_, T>;
}
Expand description

Extension trait adding poison-recovering locking to RwLock.

Required Methods§

Source

fn read_or_recover(&self) -> RwLockReadGuard<'_, T>

Acquires a read guard, recovering it if the lock is poisoned.

On poison, logs a warning naming the call site and returns the inner guard anyway.

Source

fn write_or_recover(&self) -> RwLockWriteGuard<'_, T>

Acquires a write guard, recovering it if the lock is poisoned.

On poison, logs a warning naming the call site and returns the inner guard anyway.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T> RwLockExt<T> for RwLock<T>

Implementors§