lock_api

Trait RawRwLockRecursive

Source
pub unsafe trait RawRwLockRecursive: RawRwLock {
    // Required methods
    fn lock_shared_recursive(&self);
    fn try_lock_shared_recursive(&self) -> bool;
}
Expand description

Additional methods for RwLocks which support recursive read locks.

These are guaranteed to succeed without blocking if another read lock is held at the time of the call. This allows a thread to recursively lock a RwLock. However using this method can cause writers to starve since readers no longer block if a writer is waiting for the lock.

Required Methods§

Source

fn lock_shared_recursive(&self)

Acquires a shared lock without deadlocking in case of a recursive lock.

Source

fn try_lock_shared_recursive(&self) -> bool

Attempts to acquire a shared lock without deadlocking in case of a recursive lock.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§