Struct concurrency_traits::semaphore::ParkSemaphore[][src]

pub struct ParkSemaphore<C, CS> where
    CS: ThreadParker
{ /* fields omitted */ }
Expand description

A semaphore based on thread parking

Implementations

impl<C, CS> ParkSemaphore<C, CS> where
    CS: ThreadParker
[src]

pub fn new(start_count: C) -> Self[src]

Creates a new ParkSemaphore from a start_count.

Trait Implementations

impl<C: Debug, CS: Debug> Debug for ParkSemaphore<C, CS> where
    CS: ThreadParker
[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl<C, CS> Default for ParkSemaphore<C, CS> where
    C: Zero,
    CS: ThreadParker
[src]

fn default() -> Self[src]

Returns the “default value” for a type. Read more

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

type Count = C

The type of the count read from this semaphore.

fn count(&self) -> Self::Count[src]

The count associated with this semaphore.

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

fn wait(&self)[src]

Decrements the count if able or blocks until able.

impl<C, CS> TimeoutSemaphore for ParkSemaphore<C, CS> where
    C: Zero + One + AddAssign + SubAssign,
    CS: ThreadTimeoutParker + TimeFunctions + ThreadFunctions
[src]

fn wait_timeout(&self, timeout: Duration) -> bool[src]

Blocks until can decrement or times out. Then returns true if decremented or false if timed out.

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

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

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

fn signal(&self)[src]

Increments the counter.

Auto Trait Implementations

impl<C, CS> !RefUnwindSafe for ParkSemaphore<C, CS>

impl<C, CS> Send for ParkSemaphore<C, CS> where
    C: Send,
    <CS as ThreadParker>::ThreadId: Send

impl<C, CS> Sync for ParkSemaphore<C, CS> where
    C: Send,
    <CS as ThreadParker>::ThreadId: Send

impl<C, CS> Unpin for ParkSemaphore<C, CS> where
    C: Unpin,
    <CS as ThreadParker>::ThreadId: Unpin

impl<C, CS> UnwindSafe for ParkSemaphore<C, CS> where
    C: UnwindSafe,
    <CS as ThreadParker>::ThreadId: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.