[][src]Trait os_sync::mutex::Mutex

pub trait Mutex: Sized {
    fn new() -> Option<Self>;
fn lock(&self) -> MutexGuard<Self>;
fn try_lock(&self) -> Option<MutexGuard<Self>>;
fn unlock(&self, token: GuardToken); }

Describes Mutex interface

Required methods

fn new() -> Option<Self>

Creates new instance

Returns if Semaphore is successfully created.

fn lock(&self) -> MutexGuard<Self>

Acquires lock, returning guard that unlocks self on drop.

If lock is already acquired, it blocks until mutex is unlocked

fn try_lock(&self) -> Option<MutexGuard<Self>>

Attempts to acquire lock, returning guard that unlocks self on drop.

If lock is already acquired, it returns None

fn unlock(&self, token: GuardToken)

Tells how to perform unlock.

Method implementation should be safe, but is allowed to mis-behave when invoked without prior lock

Loading content...

Implementors

impl<T: Semaphore> Mutex for Mutex<T>[src]

Loading content...