pub struct WaitQueue { /* private fields */ }Expand description
A wait queue.
One may wait on a wait queue to put its executing thread to sleep.
Multiple threads may be the waiters of a wait queue.
Other threads may invoke the wake-family methods of a wait queue to
wake up one or many waiting threads.
Implementations§
Source§impl WaitQueue
impl WaitQueue
Sourcepub exec fn wait_until<F, R>(&self, cond: F) -> ret : R
pub exec fn wait_until<F, R>(&self, cond: F) -> ret : R
requires
cond.requires(()),ensurescond.ensures((), Some(ret)),Waits until some condition is met.
This method takes a closure that tests a user-given condition.
The method only returns if the condition returns Some(_).
A waker thread should first make the condition Some(_), then invoke the
wake-family method. This ordering is important to ensure that waiter
threads do not lose any wakeup notifications.
By taking a condition closure, this wait-wakeup mechanism becomes more efficient and robust.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for WaitQueue
impl !RefUnwindSafe for WaitQueue
impl Send for WaitQueue
impl Sync for WaitQueue
impl Unpin for WaitQueue
impl UnwindSafe for WaitQueue
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