pub struct CondWait {
condvar: CondVar,
w: Mutex<bool>,
}
Expand description
CondWait is a wrapper struct for CondVar with a Mutex boolean flag.
§Example
use std::sync::Arc;
use karyon_core::async_util::CondWait;
use karyon_core::async_runtime::spawn;
async {
let cond_wait = Arc::new(CondWait::new());
let task = spawn({
let cond_wait = cond_wait.clone();
async move {
cond_wait.wait().await;
// ...
}
});
cond_wait.signal().await;
};
Fields§
§condvar: CondVar
The CondVar
w: Mutex<bool>
Boolean flag
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for CondWait
impl !RefUnwindSafe for CondWait
impl Send for CondWait
impl Sync for CondWait
impl Unpin for CondWait
impl UnwindSafe for CondWait
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