pub struct RwLock<T: ?Sized> { /* private fields */ }Expand description
A std::sync::RwLock that, with rt-paranoid on, flags a read or
write taken on the audio thread inside a process section. Same
coverage caveat as Mutex.
Implementations§
Source§impl<T> RwLock<T>
impl<T> RwLock<T>
Sourcepub fn into_inner(self) -> LockResult<T>
pub fn into_inner(self) -> LockResult<T>
Consume the lock, returning the inner value.
§Errors
Returns the poison error if a writer panicked while holding the lock.
Source§impl<T: ?Sized> RwLock<T>
impl<T: ?Sized> RwLock<T>
Sourcepub fn read(&self) -> LockResult<RwLockReadGuard<'_, T>>
pub fn read(&self) -> LockResult<RwLockReadGuard<'_, T>>
Acquire a shared read lock. Flags a real-time violation if taken
inside a process section.
§Errors
Returns the poison error if a writer panicked while holding the lock.
Sourcepub fn write(&self) -> LockResult<RwLockWriteGuard<'_, T>>
pub fn write(&self) -> LockResult<RwLockWriteGuard<'_, T>>
Acquire an exclusive write lock. Flags a real-time violation if taken
inside a process section.
§Errors
Returns the poison error if a writer panicked while holding the lock.
Sourcepub fn try_read(&self) -> TryLockResult<RwLockReadGuard<'_, T>>
pub fn try_read(&self) -> TryLockResult<RwLockReadGuard<'_, T>>
Attempt a shared read lock without blocking. Flags a real-time
violation if attempted inside a process section.
§Errors
Returns WouldBlock if a writer holds it, or the poison error.
Sourcepub fn try_write(&self) -> TryLockResult<RwLockWriteGuard<'_, T>>
pub fn try_write(&self) -> TryLockResult<RwLockWriteGuard<'_, T>>
Attempt an exclusive write lock without blocking. Flags a real-time
violation if attempted inside a process section.
§Errors
Returns WouldBlock if held elsewhere, or the poison error.
Sourcepub fn get_mut(&mut self) -> LockResult<&mut T>
pub fn get_mut(&mut self) -> LockResult<&mut T>
Borrow the inner value mutably; no lock is taken (unique access).
§Errors
Returns the poison error if a writer panicked while holding the lock.