Skip to main content

WorkStealQueue

Struct WorkStealQueue 

Source
pub struct WorkStealQueue<T: Marshal + Copy + 'static> { /* private fields */ }
Expand description

Single-owner, multi-thief work-stealing queue, backed by the SharedDeque<T> family. The owner pushes via push; thieves drain via steal.

The dispatcher’s variant pick for the caller’s workload shape is reported via variant; the generic-T: Marshal surface uses Chase-Lev as the backing because it is the only variant generic over arbitrary T: Marshal. Byte-slice workloads (e.g. scheduler PassSlot) can ride the higher- throughput KHL/KHPD/LOH/URD variants directly via the DequeDispatcher API.

Implementations§

Source§

impl<T: Marshal + Copy + 'static> WorkStealQueue<T>

Source

pub fn create( path: impl AsRef<Path>, shape: MmfWorkloadShape, capacity: usize, ) -> Result<Self, ApiError>

Create the queue at path with the given workload shape. capacity is rounded up to next pow2.

Source

pub fn open_as_thief(path: impl AsRef<Path>) -> Result<Self, ApiError>

Open an existing queue at path as a thief.

Source

pub fn push(&self, item: &T) -> Result<(), ApiError>

Owner-side push.

Source

pub fn pop(&self) -> Option<T>

Owner-side pop (LIFO end).

Source

pub fn steal(&self) -> Option<T>

Thief-side steal (FIFO end).

Source

pub fn variant(&self) -> DequeVariant

The variant the dispatcher picked for this workload.

Auto Trait Implementations§

§

impl<T> Freeze for WorkStealQueue<T>

§

impl<T> RefUnwindSafe for WorkStealQueue<T>
where T: RefUnwindSafe,

§

impl<T> Send for WorkStealQueue<T>
where T: Send,

§

impl<T> Sync for WorkStealQueue<T>
where T: Send,

§

impl<T> Unpin for WorkStealQueue<T>

§

impl<T> UnsafeUnpin for WorkStealQueue<T>

§

impl<T> UnwindSafe for WorkStealQueue<T>
where T: RefUnwindSafe,

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