pub struct WorkQueue {
pub deque: Vec<StealableTask>,
pub owner_id: u32,
}Expand description
A double-ended work queue owned by a single worker.
The owner pushes and pops from the back (LIFO); thieves steal from the front (FIFO) to minimise cache invalidation.
Fields§
§deque: Vec<StealableTask>The internal deque of tasks (front = steal end, back = owner end).
owner_id: u32Identifier of the owning worker.
Implementations§
Source§impl WorkQueue
impl WorkQueue
Sourcepub fn push(&mut self, task: StealableTask)
pub fn push(&mut self, task: StealableTask)
Push a task onto the owner’s end of the queue (back).
Sourcepub fn pop(&mut self) -> Option<StealableTask>
pub fn pop(&mut self) -> Option<StealableTask>
Pop a task from the owner’s end of the queue (back, LIFO).
Returns None if the queue is empty.
Sourcepub fn steal(&mut self) -> Option<StealableTask>
pub fn steal(&mut self) -> Option<StealableTask>
Steal a task from the thief’s end of the queue (front, FIFO).
Returns None if the queue is empty.
Sourcepub fn high_priority_tasks(&self) -> Vec<&StealableTask>
pub fn high_priority_tasks(&self) -> Vec<&StealableTask>
Returns all high-priority tasks (without removing them).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for WorkQueue
impl RefUnwindSafe for WorkQueue
impl Send for WorkQueue
impl Sync for WorkQueue
impl Unpin for WorkQueue
impl UnsafeUnpin for WorkQueue
impl UnwindSafe for WorkQueue
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request