Function wasmer_wasix::utils::owned_mutex_guard::read_owned

source ·
pub(crate) fn read_owned<T>(
    lock: &Arc<RwLock<T>>,
) -> LockResult<OwnedRwLockReadGuard<T>>
Expand description

Locks this 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 guard which will release this thread’s shared access once it is dropped.

§Errors

This function will return an error if the RwLock is poisoned. An RwLock is poisoned whenever a writer panics while holding an exclusive lock. The failure will occur immediately after the lock has been acquired.

§Panics

This function might panic when called if the lock is already held by the current thread.