GREM 3.12.0
Game/Rendering Engine Modules for C++
Loading...
Searching...
No Matches
grem::execution::ParallelTask Class Reference

Chunkable task whose chunks can be run in parallel. More...

#include <GREM/execution/Task.hpp>

Public Types

using Function = void (*)(void* subTaskContext, byte* taskSharedMemory, Task::ParallelIndex subTaskIndex, Task::ParallelCount subTaskCount)
 Callback function pointer that executes a chunk of a parallel task.

Public Member Functions

 ParallelTask (Function function) noexcept
 Construct a parallel task.
void execute (void *subTaskContext, byte *taskSharedMemory, Task::ParallelIndex subTaskIndex, Task::ParallelCount subTaskCount) const
 Execute a chunk of the parallel task.

Detailed Description

Chunkable task whose chunks can be run in parallel.

Member Typedef Documentation

◆ Function

using grem::execution::ParallelTask::Function = void (*)(void* subTaskContext, byte* taskSharedMemory, Task::ParallelIndex subTaskIndex, Task::ParallelCount subTaskCount)

Callback function pointer that executes a chunk of a parallel task.

Constructor & Destructor Documentation

◆ ParallelTask()

grem::execution::ParallelTask::ParallelTask ( Function function)
inlinenoexcept

Construct a parallel task.

Parameters
functioncallback function that executes a chunk of the parallel task.

Member Function Documentation

◆ execute()

void grem::execution::ParallelTask::execute ( void * subTaskContext,
byte * taskSharedMemory,
Task::ParallelIndex subTaskIndex,
Task::ParallelCount subTaskCount ) const
inline

Execute a chunk of the parallel task.

Parameters
subTaskContextuser-defined context pointer to pass to the callback function's void* subTaskContext parameter.
taskSharedMemorynon-owning pointer to the shared memory to provide to the callback function's byte* taskSharedMemory parameter.
subTaskIndexindex of the chunk to execute. Must be less than subTaskCount.
subTaskCountnumber of chunks that this invocation is part of. Must be positive.
Exceptions
anyexception thrown by the parallel task's callback function.

The documentation for this class was generated from the following file: