Navigation
API > API/Runtime > API/Runtime/Core > API/Runtime/Core/Async > API/Runtime/Core/Async/ParallelForWithExistingTaskConte-
References
| Module | Core |
| Header | /Engine/Source/Runtime/Core/Public/Async/ParallelFor.h |
| Include | #include "Async/ParallelFor.h" |
template<typename ContextType, typename FunctionType>
void ParallelForWithExistingTaskContext
(
const TCHAR * DebugName,
TArrayView < ContextType > Contexts,
int32 Num,
int32 MinBatchSize,
const FunctionType & Body,
EParallelForFlags Flags
)
Remarks
General purpose parallel for that uses the taskgraph. This variant takes an array of user-defined context objects for each task that may get spawned to do work (one task per context at most), and passes them to the loop body to give it a task-local "workspace" that can be mutated without need for synchronization primitives.
Parameters
| Name | Description |
|---|---|
| DebugName; | ProfilingScope and Debugname |
| Contexts; | User-privided array of user-defined task-level context objects |
| Num; | number of calls of Body; Body(0), Body(1)....Body(Num - 1) |
| MinBatchSize; | Minimum Size of a Batch (will only launch DivUp(Num, MinBatchSize) Workers |
| Body; | Function to call from multiple threads |
| Flags; | Used to customize the behavior of the ParallelFor if needed. Notes: Please add stats around to calls to parallel for and within your lambda as appropriate. Do not clog the task graph with long running tasks or tasks that block. |