pub struct ConditionGuard<'a, T>(/* private fields */);Expand description
Guard returned by lock.
Implementations§
Source§impl<'a, T> ConditionGuard<'a, T>
impl<'a, T> ConditionGuard<'a, T>
Sourcepub fn add_waker(&mut self, waker_entry: Pin<&mut WakerEntry<T>>, waker: Waker)
pub fn add_waker(&mut self, waker_entry: Pin<&mut WakerEntry<T>>, waker: Waker)
Adds the waker entry to the condition’s list of wakers.
§Panics
This will panic if the waker entry is associated with a different Condition.
Sourcepub fn drain_wakers<'b>(&'b mut self) -> Drainer<'b, 'a, T> ⓘ
pub fn drain_wakers<'b>(&'b mut self) -> Drainer<'b, 'a, T> ⓘ
Returns an iterator that will drain all wakers. Whilst the drainer exists, a lock is held
which will prevent new wakers from being added to the list, so depending on your use case,
you might wish to collect the wakers before calling wake on each waker. NOTE: If the
drainer is dropped, this will not drain elements not visited.
Sourcepub fn waker_count(&self) -> usize
pub fn waker_count(&self) -> usize
Returns the number of wakers registered with the condition.
Sourcepub fn block_until(&mut self, condition: impl FnMut(&mut Self) -> bool)
pub fn block_until(&mut self, condition: impl FnMut(&mut Self) -> bool)
Blocks the current thread until condition returns true.
The mutex is unlocked while waiting and re-locked before this function returns.
Trait Implementations§
Source§impl<T> Deref for ConditionGuard<'_, T>
impl<T> Deref for ConditionGuard<'_, T>
Auto Trait Implementations§
impl<'a, T> !RefUnwindSafe for ConditionGuard<'a, T>
impl<'a, T> !Send for ConditionGuard<'a, T>
impl<'a, T> !Sync for ConditionGuard<'a, T>
impl<'a, T> !UnwindSafe for ConditionGuard<'a, T>
impl<'a, T> Freeze for ConditionGuard<'a, T>
impl<'a, T> Unpin for ConditionGuard<'a, T>
impl<'a, T> UnsafeUnpin for ConditionGuard<'a, T>
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