Struct sync::condvar::Condvar

source ·
pub struct Condvar {
    std: Condvar,
}
Expand description

A Condition Variable.

Fields§

§std: Condvar

Implementations§

source§

impl Condvar

source

pub const fn new() -> Condvar

Creates a new condvar that is ready to be waited on.

source

pub fn wait<'a, T>(&self, guard: MutexGuard<'a, T>) -> MutexGuard<'a, T>

Waits on a condvar, blocking the current thread until it is notified.

source

pub fn wait_while<'a, T, F>( &self, guard: MutexGuard<'a, T>, condition: F ) -> MutexGuard<'a, T>where F: FnMut(&mut T) -> bool,

Blocks the current thread until this condition variable receives a notification and the provided condition is false.

source

pub fn wait_timeout<'a, T>( &self, guard: MutexGuard<'a, T>, dur: Duration ) -> (MutexGuard<'a, T>, WaitTimeoutResult)

Waits on a condvar, blocking the current thread until it is notified or the specified duration has elapsed.

source

pub fn wait_timeout_while<'a, T, F>( &self, guard: MutexGuard<'a, T>, dur: Duration, condition: F ) -> (MutexGuard<'a, T>, WaitTimeoutResult)where F: FnMut(&mut T) -> bool,

Waits on this condition variable for a notification, timing out after a specified duration.

source

pub fn notify_one(&self)

Notifies one thread blocked by this condvar.

source

pub fn notify_all(&self)

Notifies all threads blocked by this condvar.

Trait Implementations§

source§

impl Debug for Condvar

source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Condvar

source§

fn default() -> Condvar

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

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

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

Performs the conversion.