pub struct FlagBlock { /* private fields */ }
Expand description
A basic condition variable for async tasks. If you call wait() you get back a future that you can await on, which will complete once another tasks calls signal_all(). But there’s a gotcha here.
Okay so you know the rule with mutexes and condition variables? Like, you have some predicate that tells you “ready” or not, and this is tested with the mutex held, followed by waiting on the condition variable (which automatically releases and reaquires the lock).
We have something similar. You need to call wait() with that mutex held, and then after you release the lock, you call await on the future returned by wait().
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for FlagBlock
impl !ObjSafe for FlagBlock
impl RefUnwindSafe for FlagBlock
impl Send for FlagBlock
impl Sync for FlagBlock
impl Unpin for FlagBlock
impl UnwindSafe for FlagBlock
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