Struct guardian::ArcRwLockReadGuardian [] [src]

pub struct ArcRwLockReadGuardian<T: 'static> {
    // some fields omitted
}

RAII structure used to release the shared read access of a lock when dropped. Keeps a handle to an Arc so that the lock is not dropped until the guard is.

The data protected by the mutex can be access through this guard via its Deref and DerefMut implementations.

Methods

impl<T> ArcRwLockReadGuardian<T>
[src]

fn take(handle: Arc<RwLock<T>>) -> LockResult<ArcRwLockReadGuardian<T>>

Locks the given rwlock with shared read access, blocking the current thread until it can be acquired.

The calling thread will be blocked until there are no more writers which hold the lock. There may be other readers currently inside the lock when this method returns. This method does not provide any guarantees with respect to the ordering of whether contentious readers or writers will acquire the lock first.

Returns an RAII guardian which will release this thread's shared access once it is dropped. The guardian also holds a strong reference to the lock's Arc, which is dropped when the guard is.

Trait Implementations

impl<T> Deref for ArcRwLockReadGuardian<T>
[src]

type Target = T

The resulting type after dereferencing

fn deref(&self) -> &Self::Target

The method called to dereference a value

impl<T> From<Arc<RwLock<T>>> for ArcRwLockReadGuardian<T>
[src]

fn from(handle: Arc<RwLock<T>>) -> Self

Performs the conversion.