carb::tasking::TaskDesc

Defined in carb/tasking/TaskingTypes.h

struct TaskDesc

Defines a task descriptor.

Public Functions

inline constexpr TaskDesc(OnTaskFn task_ = nullptr, void *taskArg_ = nullptr, Priority priority_ = Priority::eLow, Counter *requiredCounter_ = nullptr, Semaphore *waitSemaphore_ = nullptr, OnTaskFn cancel_ = nullptr)

Constructor.

Public Members

size_t size = {sizeof(TaskDesc)}

Must be set to sizeof(TaskDesc).

OnTaskFn task

The task function to execute.

void *taskArg

The argument passed to the task function.

Priority priority

The priority assigned to the task.

Object requiredObject

If not nullptr, then the task will only start when this counter reaches its target value. Specifying the counter here is more efficient than having the task function yieldUntilCounter().

Semaphore *waitSemaphore

If waitSemaphore is not nullptr, then the task will wait on the semaphore before starting. This can be used to throttle tasks. If requiredObject is also specified, then the semaphore is not waited on until requiredObject has reached its target value. Specifying the semaphore here is more efficient than having the task function wait on the semaphore.

OnTaskFn cancel

Optional. An OnTaskFn that is executed only when ITasking::tryCancelTask() successfully cancels the task. Called in the context of ITasking::tryCancelTask(). Typically provided to destroy taskArg.