[−][src]Struct greenie::common::condvar::Condvar
Synchronization primitive that can be used to block a thread, or multiple threads at the same time, until another thread both modifies a shared variable (the condition), and notifies the condition_variable.
Methods
impl Condvar
[src]
pub fn new() -> Self
[src]
pub fn wait_for_mutex(&self, m: &Mutex)
[src]
wait causes the current thread to block until the condition variable is notified or a spurious wakeup occurs, optionally looping until some predicate is satisfied.
Atomically unlocks lock, blocks the current executing thread, and adds it to the list of threads waiting on self
.
The thread will be unblocked when notify_all() or notify_one() is executed. It may also be unblocked spuriously.
When unblocked, regardless of the reason, lock is reacquired and wait exits.
pub fn wait_pred(&self, m: &Mutex, pred: impl FnMut() -> bool)
[src]
Equivalent to
while !pred() { self.wait_for_mutex(m); }
pub fn notify_one(&self)
[src]
If any threads are waiting on this condvar, calling notify_one unblocks one of the waiting threads.
pub fn notify_all(&self)
[src]
Unblocks all threads currently waiting for this condvar.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Condvar
impl !Send for Condvar
impl !Sync for Condvar
impl Unpin for Condvar
impl !UnwindSafe for Condvar
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,