pub struct WaitGuard<'a, T: Clone + 'a> { /* private fields */ }
Expand description
Callers link a Waiter into the list and protect it with a WaitGuard. The WaitGuard will panic if the caller fails to unlink.
Implementations§
source§impl<'a, T: Clone + 'a> WaitGuard<'a, T>
impl<'a, T: Clone + 'a> WaitGuard<'a, T>
sourcepub fn iter<'b: 'a>(&'b self) -> WaitIterator<'b, T> ⓘ
pub fn iter<'b: 'a>(&'b self) -> WaitIterator<'b, T> ⓘ
Iterate the list from our position forward.
sourcepub fn is_head(&mut self) -> bool
pub fn is_head(&mut self) -> bool
True iff the thread is the lowest-index thread in the system.
sourcepub fn count(&mut self) -> u64
pub fn count(&mut self) -> u64
Count how many threads are in the list. This should be used for debugging, not for logic.
sourcepub fn get_waiter<'c, 'b: 'c>(
&'b mut self,
index: u64
) -> Option<WaitGuard<'c, T>>
pub fn get_waiter<'c, 'b: 'c>( &'b mut self, index: u64 ) -> Option<WaitGuard<'c, T>>
Use the WaitGuard provided by self
to get a wait guard to a later position in the list.
It is not possible to get a wait guard to an index less than our own position. This
limitation enables us to enforce lifetimes with the borrow checker. Returns None if the
owner called unlink on the index.
sourcepub fn naked_wait<'b, M>(&self, guard: MutexGuard<'b, M>) -> MutexGuard<'b, M>
pub fn naked_wait<'b, M>(&self, guard: MutexGuard<'b, M>) -> MutexGuard<'b, M>
Atomically unlock the guard and wait on the internal condition variable.
sourcepub fn wait_for_store<'b, M>(
&self,
guard: MutexGuard<'b, M>
) -> (MutexGuard<'b, M>, T)
pub fn wait_for_store<'b, M>( &self, guard: MutexGuard<'b, M> ) -> (MutexGuard<'b, M>, T)
Wait until someone stores a value in the guard. Note that you must always make sure that some other thread will call store on this wait guard’s index.