Struct work_queue::LocalQueue

source ·
pub struct LocalQueue<T> { /* private fields */ }
Expand description

One of the local queues in a Queue.

You can create this using Queue::local_queues.

Implementations§

source§

impl<T> LocalQueue<T>

source

pub fn push(&mut self, item: T)

Push an item to the local queue. If the local queue is full, it will move half of its items to the global queue.

source

pub fn push_yield(&mut self, item: T)

Push an item to the local queue, skipping the LIFO slot. This can be used to give other tasks a chance to run. Otherwise, there’s a risk that one task will completely take over a thread in a push-pop cycle due to the LIFO slot.

source

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

Pop an item from the local queue, or steal from the global and sibling queues if it is empty.

source

pub fn searchers(&self) -> usize

Get the number of threads that are currently searching for work inside pop.

If this number is too high, you may wish to avoid calling pop to reduce contention.

source

pub fn global(&self) -> &Queue<T>

Get the global queue that is associated with this local queue.

Trait Implementations§

source§

impl<T: Debug> Debug for LocalQueue<T>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<T> !RefUnwindSafe for LocalQueue<T>

§

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

§

impl<T> Sync for LocalQueue<T>where T: Send + Sync,

§

impl<T> Unpin for LocalQueue<T>where T: Unpin,

§

impl<T> !UnwindSafe for LocalQueue<T>

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