Function Adds a task to the current task Group.
Syntax
#include <dx/dx.h> Error DXAddTask(Error(*proc)(Pointer), Pointer arg, int size, double work).
Functional Details The task to be added is defined by the following parameters:
proc | A pointer to a function that performs the task. It takes one argument of type Pointer. |
arg | A pointer to an argument block. |
size | The size of the argument block in bytes. If size is nonzero, the argument block is copied. Otherwise, the value of arg is passed to proc without copying, which is useful for passing integers or Objects. |
work | The estimated amount of time required by the task in arbitrary units. |
Tasks are executed, in parallel if possible, by DXExecuteTaskGroup. Executing a task consists of calling (*proc)(arg). To facilitate load balancing, tasks are executed in order of decreasing work estimates. Once DXExecuteTaskGroup has been called, additional tasks can be created only from other tasks in the current task Group, and they are run as soon as possible, without regard to work or the status of the original tasks.
Return Value Returns OK or returns ERROR and sets an error code.
See Also DXAbortTaskGroup, DXCreateTaskGroup, DXExecuteTaskGroup, DXProcessorId, DXProcessors