pub struct Condvar { /* private fields */ }Expand description
Async condition variable pairing with the async Mutex.
Implementations§
Source§impl Condvar
impl Condvar
Sourcepub async fn wait<'a, T>(&self, guard: MutexGuard<'a, T>) -> MutexGuard<'a, T>
pub async fn wait<'a, T>(&self, guard: MutexGuard<'a, T>) -> MutexGuard<'a, T>
Release the guard, wait for a notification, and reacquire.
Sourcepub async fn wait_while<'a, T, F>(
&self,
guard: MutexGuard<'a, T>,
condition: F,
) -> MutexGuard<'a, T>
pub async fn wait_while<'a, T, F>( &self, guard: MutexGuard<'a, T>, condition: F, ) -> MutexGuard<'a, T>
Wait until condition on the guarded value turns false.
Sourcepub fn notify_one(&self)
pub fn notify_one(&self)
Wake the oldest waiter, if any.
The waker is taken under the state lock and woken after it is released:
Waker::wake may poll the task inline on this thread, and that poll
re-locks this state — waking under the lock would self-deadlock. Same
discipline as notify_all below and hybrid::notify.
Sourcepub fn notify_all(&self)
pub fn notify_all(&self)
Wake every current waiter.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Condvar
impl RefUnwindSafe for Condvar
impl Send for Condvar
impl Sync for Condvar
impl Unpin for Condvar
impl UnsafeUnpin for Condvar
impl UnwindSafe for Condvar
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more