Struct kernel::sync::CondVar[][src]

pub struct CondVar { /* fields omitted */ }
Expand description

Exposes the kernel’s struct wait_queue_head as a condition variable. It allows the caller to atomically release the given lock and go to sleep. It reacquires the lock when it wakes up. And it wakes up when notified by another thread (via CondVar::notify_one or CondVar::notify_all) or because the thread received a signal.

Implementations

Constructs a new conditional variable.

Safety

The caller must call CondVar::init before using the conditional variable.

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 the thread receives a signal.

Returns whether there is a signal pending.

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).

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).

Wakes all waiters up. If they were added by epoll, they are also removed from the list of waiters. This is useful when cleaning up a condition variable that may be waited on by threads that use epoll.

Trait Implementations

Initialises the type instance so that it can be safely used. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.