Table of Contents

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

array Array

The array to process.

taskThreshold int

Minimum elements per batch. Fewer elements result in a single batch.

action Action<Parallel.Batch>

The callback to invoke for each batch.

execute bool

If true, calls Execute() to start execution.

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

list ReadOnlyPartitionedSet<T>

The set to process.

taskThreshold int

Minimum elements per batch. Fewer elements result in a single batch.

action Action<Parallel.Batch>

The callback to invoke for each batch.

execute bool

If true, calls Execute() to start execution.

Returns

int

The number of batches generated.

Type Parameters

T

The 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

list PartitionedBuffer<T>

The buffer to process.

taskThreshold int

Minimum elements per batch. Fewer elements result in a single batch.

action Action<Parallel.Batch>

The callback to invoke for each batch.

execute bool

If true, calls Execute() to start execution.

Returns

int

The number of batches generated.

Type Parameters

T

The unmanaged element type.