pub struct Condvar { /* private fields */ }Expand description
Futex-based condition variable.
Drop-in replacement for parking_lot::Condvar. Works exclusively with
noxu_sync::Mutex<T> guards.
Implementations§
Source§impl Condvar
impl Condvar
Sourcepub fn wait<T>(&self, guard: &mut MutexGuard<'_, T>)
pub fn wait<T>(&self, guard: &mut MutexGuard<'_, T>)
Atomically releases the mutex guard and waits for a notification.
Re-acquires the mutex before returning. Spurious wakeups are possible; callers must re-check their condition in a loop.
§Panics
Does not panic. Safe to call from any thread holding the guard.
Sourcepub fn wait_for<T>(
&self,
guard: &mut MutexGuard<'_, T>,
timeout: Duration,
) -> WaitTimeoutResult
pub fn wait_for<T>( &self, guard: &mut MutexGuard<'_, T>, timeout: Duration, ) -> WaitTimeoutResult
Atomically releases the mutex guard, waits for a notification or timeout.
Returns WaitTimeoutResult(true) if the timeout elapsed, false if notified.
Sourcepub fn notify_one(&self)
pub fn notify_one(&self)
Wakes one thread waiting on this condvar.
Sourcepub fn notify_all(&self)
pub fn notify_all(&self)
Wakes all threads waiting on this condvar.
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