Trait concurrency_traits::semaphore::TrySemaphore[][src]

pub unsafe trait TrySemaphore: Default {
    fn try_wait(&self) -> bool;
fn signal(&self); }
Expand description

A generic semaphore that has try operations.

Safety

This trait is marked as unsafe to allow for safe code to rely on the standard semaphore contract. Default implementations should initialize the count at 0.

Required methods

fn try_wait(&self) -> bool[src]

Returns true if can decrement and did, or false if cannot.

fn signal(&self)[src]

Increments the counter.

Implementors

impl TrySemaphore for AtomicSemaphore[src]

fn try_wait(&self) -> bool[src]

fn signal(&self)[src]

impl<C, CS> TrySemaphore for FullAsyncSemaphore<C, CS> where
    C: Zero + One + AddAssign + SubAssign,
    CS: ThreadFunctions
[src]

fn try_wait(&self) -> bool[src]

fn signal(&self)[src]

impl<C, CS> TrySemaphore for ParkSemaphore<C, CS> where
    C: Zero + One + AddAssign + SubAssign,
    CS: ThreadParker + ThreadFunctions
[src]

fn try_wait(&self) -> bool[src]

fn signal(&self)[src]