[][src]Trait semka::BinarySemaphore

pub trait BinarySemaphore: Sized {
    fn new() -> Option<Self>;
fn lock(&self) -> BinaryLock<Self>; }

Describes binary Semaphore interface.

It's state can be described as bool. Any attempt to wait would result in locking self (i.e. setting state to true) Which means unless lock is dropped, any further lock would block calling thread.

Any CountingSemaphore can be used as BinarySemaphore whenever it's initial count is 1

Required methods

fn new() -> Option<Self>

Creates new instance, initially unlocked

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

Locks self, returning guard that unlocks on drop.

Loading content...

Implementors

impl BinarySemaphore for Sem[src]

impl<T: CountingSemaphore> BinarySemaphore for T[src]

Loading content...