Class ParallelExtensions
- Namespace
- Jitter2.Parallelization
- Assembly
- Jitter2.dll
Divides collections into index ranges for parallel processing.
public static class ParallelExtensions
- Inheritance
-
ParallelExtensions
- Inherited Members
Remarks
Callbacks may run concurrently. With execute: true, each method waits for completion;
otherwise, call Execute() on the shared pool to run the queued batches.
Do not queue batches concurrently or change a collection while its batches are being processed.
Methods
ParallelForBatch(Array, int, Action<Batch>, bool)
Processes array elements in parallel batches.
public static int ParallelForBatch(this Array array, int taskThreshold, Action<Parallel.Batch> action, bool execute = true)
Parameters
arrayArrayThe array to process.
taskThresholdintPositive target batch size used to choose the number of batches; actual batches can be smaller or larger.
actionAction<Parallel.Batch>The callback to invoke for each batch.
executebool
Returns
- int
The number of batches generated.
ParallelForBatch<T>(ReadOnlyPartitionedSet<T>, int, Action<Batch>, bool)
Processes active elements of a ReadOnlyPartitionedSet<T> in parallel batches.
public static int ParallelForBatch<T>(this ReadOnlyPartitionedSet<T> list, int taskThreshold, Action<Parallel.Batch> action, bool execute = true) where T : class, IPartitionedSetIndex
Parameters
listReadOnlyPartitionedSet<T>The set to process.
taskThresholdintPositive target batch size used to choose the number of batches; actual batches can be smaller or larger.
actionAction<Parallel.Batch>The callback to invoke for each batch.
executebool
Returns
- int
The number of batches generated.
Type Parameters
TThe element type.
ParallelForBatch<T>(PartitionedBuffer<T>, int, Action<Batch>, bool)
Processes active elements of a PartitionedBuffer<T> in parallel batches.
public static int ParallelForBatch<T>(this PartitionedBuffer<T> list, int taskThreshold, Action<Parallel.Batch> action, bool execute = true) where T : unmanaged
Parameters
listPartitionedBuffer<T>The buffer to process.
taskThresholdintPositive target batch size used to choose the number of batches; actual batches can be smaller or larger.
actionAction<Parallel.Batch>The callback to invoke for each batch.
executebool
Returns
- int
The number of batches generated.
Type Parameters
TThe unmanaged element type.