pub struct PollCondVar { /* private fields */ }
Implementations§
Source§impl PollCondVar
impl PollCondVar
Sourcepub fn new(
name: &'static CStr,
key: &'static LockClassKey,
) -> impl PinInit<Self>
pub fn new( name: &'static CStr, key: &'static LockClassKey, ) -> impl PinInit<Self>
Constructs a new condvar initialiser.
Methods from Deref<Target = CondVar>§
Sourcepub fn wait<T: ?Sized, B: Backend>(&self, guard: &mut Guard<'_, T, B>)
pub fn wait<T: ?Sized, B: Backend>(&self, guard: &mut Guard<'_, T, B>)
Releases the lock and waits for a notification in uninterruptible mode.
Atomically releases the given lock (whose ownership is proven by the guard) and puts the
thread to sleep, reacquiring the lock on wake up. It wakes up when notified by
CondVar::notify_one
or CondVar::notify_all
. Note that it may also wake up
spuriously.
Sourcepub fn wait_interruptible<T: ?Sized, B: Backend>(
&self,
guard: &mut Guard<'_, T, B>,
) -> bool
pub fn wait_interruptible<T: ?Sized, B: Backend>( &self, guard: &mut Guard<'_, T, B>, ) -> bool
Releases the lock and waits for a notification in interruptible mode.
Similar to CondVar::wait
, except that the wait is interruptible. That is, the thread may
wake up due to signals. It may also wake up spuriously.
Returns whether there is a signal pending.
Sourcepub fn wait_interruptible_timeout<T: ?Sized, B: Backend>(
&self,
guard: &mut Guard<'_, T, B>,
jiffies: Jiffies,
) -> CondVarTimeoutResult
pub fn wait_interruptible_timeout<T: ?Sized, B: Backend>( &self, guard: &mut Guard<'_, T, B>, jiffies: Jiffies, ) -> CondVarTimeoutResult
Releases the lock and waits for a notification in interruptible mode.
Atomically releases the given lock (whose ownership is proven by the guard) and puts the
thread to sleep. It wakes up when notified by CondVar::notify_one
or
CondVar::notify_all
, or when a timeout occurs, or when the thread receives a signal.
Sourcepub fn notify_sync(&self)
pub fn notify_sync(&self)
Calls the kernel function to notify one thread synchronously.
This method behaves like notify_one
, except that it hints to the scheduler that the
current thread is about to go to sleep, so it should schedule the target thread on the same
CPU.
Sourcepub fn notify_one(&self)
pub fn notify_one(&self)
Wakes a single waiter up, if any.
This is not ‘sticky’ in the sense that if no thread is waiting, the notification is lost completely (as opposed to automatically waking up the next waiter).
Sourcepub fn notify_all(&self)
pub fn notify_all(&self)
Wakes all waiters up, if any.
This is not ‘sticky’ in the sense that if no thread is waiting, the notification is lost completely (as opposed to automatically waking up the next waiter).