Struct mioco::sync::Mutex
[−]
[src]
pub struct Mutex<T: ?Sized> { /* fields omitted */ }
A Mutex
Based on std::sync::Mutex
.
Calls mioco::yield_now()
on contention. (NOTE: Subject to potential change).
Works both inside and outside of mioco.
Methods
impl<T> Mutex<T>
[src]
fn new(t: T) -> Self
Creates a new instance of an Mutex
impl<T: ?Sized> Mutex<T>
[src]
fn native_lock(&self) -> &Mutex<T>
Get a reference to raw std::sync::Mutex
.
Use it to perform operations outside of mioco coroutines.
fn lock(&self) -> LockResult<MutexGuard<T>>
Acquire a mutex, blocking the current coroutine until it is able to do so.
fn try_lock(&self) -> TryLockResult<MutexGuard<T>>
Attempt to acquire this lock.