pub struct WorkStealingRangeFactory {
num_elements: usize,
ranges: Arc<Vec<AtomicRange>>,
}Expand description
A factory for ranges that implement work stealing among threads.
Whenever a thread finishes processing its range, it looks for another range to steal from. It then divides that range into two and steals a half, to continue processing items.
Fields§
§num_elements: usizeTotal number of elements to iterate over.
ranges: Arc<Vec<AtomicRange>>Handle to the ranges of all the threads.
Trait Implementations§
Source§impl RangeFactory for WorkStealingRangeFactory
impl RangeFactory for WorkStealingRangeFactory
type Rn = WorkStealingRange
type Orchestrator = WorkStealingRangeOrchestrator
Source§fn new(num_elements: usize, num_threads: usize) -> Self
fn new(num_elements: usize, num_threads: usize) -> Self
Creates a new factory for a range with the given number of elements
split across the given number of threads.
Source§fn orchestrator(self) -> WorkStealingRangeOrchestrator
fn orchestrator(self) -> WorkStealingRangeOrchestrator
Returns the orchestrator object for all the ranges created by this
factory.
Source§fn range(&self, thread_id: usize) -> WorkStealingRange
fn range(&self, thread_id: usize) -> WorkStealingRange
Returns the range for the given thread.
Auto Trait Implementations§
impl Freeze for WorkStealingRangeFactory
impl RefUnwindSafe for WorkStealingRangeFactory
impl Send for WorkStealingRangeFactory
impl Sync for WorkStealingRangeFactory
impl Unpin for WorkStealingRangeFactory
impl UnwindSafe for WorkStealingRangeFactory
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more