[−][src]Trait semka::BinarySemaphore
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.