Module condition

Source
Expand description

Implements a combined mutex and condition.

§Example:

    let condition = Condition::new(0);
    condition.when(|state| if state == 1 { Poll::Ready(()) } else { Poll::Pending }).await;

    // Elsewhere...
    let guard = condition.lock();
    *guard.lock() = 1;
    for waker in guard.drain_wakers() {
        waker.wake();
    }

Structs§

Condition
An async condition which combines a mutex and a condition variable.
ConditionGuard
Guard returned by lock.
Drainer
An iterator that will drain waiters.
WakerEntry
A waker entry that can be added to a list.