Struct mioco::sync::RwLock
[−]
[src]
pub struct RwLock<T: ?Sized> { /* fields omitted */ }
A reader-writer lock
Based on std::sync::RwLock
. Calls mioco::yield_now()
on contention.
Works both inside and outside of mioco.
Methods
impl<T> RwLock<T>
[src]
fn new(t: T) -> Self
Creates a new instance of an RwLock
impl<T: ?Sized> RwLock<T>
[src]
fn native_lock(&self) -> &RwLock<T>
Get a reference to raw std::sync::RwLock
.
Use it to perform operations outside of mioco coroutines.
fn read(&self) -> LockResult<RwLockReadGuard<T>>
Locks this rwlock with shared read access, blocking the current coroutine until it can be acquired.
fn try_read(&self) -> TryLockResult<RwLockReadGuard<T>>
Attempts to acquire this rwlock with shared read access.
fn write(&self) -> LockResult<RwLockWriteGuard<T>>
Locks this rwlock with exclusive write access, blocking the current coroutine until it can be acquired.
fn try_write(&self) -> TryLockResult<RwLockWriteGuard<T>>
Attempts to lock this rwlock with exclusive write access.
fn is_poisoned(&self) -> bool
Determines whether the lock is poisoned.