kernel::sync::poll

Struct PollCondVar

Source
pub struct PollCondVar { /* private fields */ }
Expand description

A wrapper around CondVar that makes it usable with PollTable.

Implementations§

Source§

impl PollCondVar

Source

pub fn new( name: &'static CStr, key: &'static LockClassKey, ) -> impl PinInit<Self>

Constructs a new condvar initialiser.

Methods from Deref<Target = CondVar>§

Source

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.

Source

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.

Source

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.

Source

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.

Source

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

Source

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

Trait Implementations§

Source§

impl Deref for PollCondVar

Source§

type Target = CondVar

The resulting type after dereferencing.
Source§

fn deref(&self) -> &CondVar

Dereferences the value.
Source§

impl Drop for PollCondVar

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl PinnedDrop for PollCondVar

Source§

fn drop(self: Pin<&mut Self>, _: OnlyCallFromDrop)

Executes the pinned destructor of this type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, E> Init<T, E> for T

Source§

unsafe fn __init(self, slot: *mut T) -> Result<(), E>

Initializes slot. Read more
Source§

fn chain<F>(self, f: F) -> ChainInit<Self, F, T, E>
where F: FnOnce(&mut T) -> Result<(), E>,

First initializes the value using self then calls the function f with the initialized value. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, E> PinInit<T, E> for T

Source§

unsafe fn __pinned_init(self, slot: *mut T) -> Result<(), E>

Initializes slot. Read more
Source§

fn pin_chain<F>(self, f: F) -> ChainPinInit<Self, F, T, E>
where F: FnOnce(Pin<&mut T>) -> Result<(), E>,

First initializes the value using self then calls the function f with the initialized value. Read more
Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.