Skip to main content

RecursiveRwLock

Type Alias RecursiveRwLock 

Source
pub type RecursiveRwLock<T> = RwLock<RawRwLockRecursive, T>;
Expand description

A reader-writer lock which permits recursive read locking.

This type of lock allows a number of readers or at most one writer at any point in time. Unlike RwLock, a thread can hold multiple read locks without deadlocking, at the cost of allowing writers to starve.

§Examples

use parking_lot::RecursiveRwLock;

let lock = RecursiveRwLock::new(5);
let first = lock.read();
let second = lock.read();
assert_eq!(*first, *second);

Aliased Type§

pub struct RecursiveRwLock<T> { /* private fields */ }