Struct kernel::workqueue::Queue

source ·
#[repr(transparent)]
pub struct Queue(/* private fields */);
Expand description

A kernel work queue.

Wraps the kernel’s C struct workqueue_struct.

It allows work items to be queued to run on thread pools managed by the kernel. Several are always available, for example, system, system_highpri, system_long, etc.

Implementations§

source§

impl Queue

source

pub unsafe fn from_raw<'a>(ptr: *const workqueue_struct) -> &'a Queue

Use the provided struct workqueue_struct with Rust.

Safety

The caller must ensure that the provided raw pointer is not dangling, that it points at a valid workqueue, and that it remains valid until the end of ’a.

source

pub fn enqueue<W, const ID: u64>(&self, w: W) -> W::EnqueueOutputwhere W: RawWorkItem<ID> + Send + 'static,

Enqueues a work item.

This may fail if the work item is already enqueued in a workqueue.

The work item will be submitted using WORK_CPU_UNBOUND.

source

pub fn try_spawn<T: 'static + Send + FnOnce()>( &self, func: T ) -> Result<(), AllocError>

Tries to spawn the given function or closure as a work item.

This method can fail because it allocates memory to store the work item.

Trait Implementations§

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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<T, U> TryFrom<U> for Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.