pub(crate) struct Local<T: 'static> {
inner: Arc<Inner<T>>,
}
Expand description
Producer handle. May only be used from a single thread.
Fields§
§inner: Arc<Inner<T>>
Implementations§
source§impl<T> Local<T>
impl<T> Local<T>
sourcepub(crate) fn remaining_slots(&self) -> usize
pub(crate) fn remaining_slots(&self) -> usize
How many tasks can be pushed into the queue
pub(crate) fn max_capacity(&self) -> usize
sourcepub(crate) fn has_tasks(&self) -> bool
pub(crate) fn has_tasks(&self) -> bool
Returns false if there are any entries in the queue
Separate to is_stealable
so that refactors of is_stealable
to “protect”
some tasks from stealing won’t affect this
sourcepub(crate) fn push_back(
&mut self,
tasks: impl ExactSizeIterator<Item = Notified<T>>,
)
pub(crate) fn push_back( &mut self, tasks: impl ExactSizeIterator<Item = Notified<T>>, )
Pushes a batch of tasks to the back of the queue. All tasks must fit in the local queue.
§Panics
The method panics if there is not enough capacity to fit in the queue.
sourcepub(crate) fn push_back_or_overflow<O: Overflow<T>>(
&mut self,
task: Notified<T>,
overflow: &O,
stats: &mut Stats,
)
pub(crate) fn push_back_or_overflow<O: Overflow<T>>( &mut self, task: Notified<T>, overflow: &O, stats: &mut Stats, )
Pushes a task to the back of the local queue, if there is not enough capacity in the queue, this triggers the overflow operation.
When the queue overflows, half of the current contents of the queue is moved to the given Injection queue. This frees up capacity for more tasks to be pushed into the local queue.
fn push_back_finish(&self, task: Notified<T>, tail: u32)
sourcefn push_overflow<O: Overflow<T>>(
&mut self,
task: Notified<T>,
head: u32,
tail: u32,
overflow: &O,
stats: &mut Stats,
) -> Result<(), Notified<T>>
fn push_overflow<O: Overflow<T>>( &mut self, task: Notified<T>, head: u32, tail: u32, overflow: &O, stats: &mut Stats, ) -> Result<(), Notified<T>>
Moves a batch of tasks into the inject queue.
This will temporarily make some of the tasks unavailable to stealers.
Once push_overflow
is done, a notification is sent out, so if other
workers “missed” some of the tasks during a steal, they will get
another opportunity.