Class ParallelExtensions
- Namespace
- Jitter2.Parallelization
- Assembly
- Jitter2.dll
Provides parallel batch processing extension methods for collections used by the physics engine.
public static class ParallelExtensions
- Inheritance
-
ParallelExtensions
- Inherited Members
Remarks
These methods divide collections into batches and distribute them across worker threads. The batch count is determined by the task threshold and available threads.
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.
taskThresholdintMinimum elements per batch. Fewer elements result in a single batch.
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.
taskThresholdintMinimum elements per batch. Fewer elements result in a single batch.
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.
taskThresholdintMinimum elements per batch. Fewer elements result in a single batch.
actionAction<Parallel.Batch>The callback to invoke for each batch.
executebool
Returns
- int
The number of batches generated.
Type Parameters
TThe unmanaged element type.