|
CX Framework
Cross-platform C utility framework
|
Data Structures | |
| struct | BasicTask |
| Bare minimum task object with state tracking and run method. More... | |
Macros | |
| #define | btaskRun(self, tq, worker, tcon) (self)->_->run(BasicTask(self), TaskQueue(tq), TQWorker(worker), tcon) |
| #define | btaskRunCancelled(self, tq, worker) (self)->_->runCancelled(BasicTask(self), TaskQueue(tq), TQWorker(worker)) |
| #define | btaskCancel(self) (self)->_->cancel(BasicTask(self)) |
| #define | btaskReset(self) (self)->_->reset(BasicTask(self)) |
Typedefs | |
| typedef struct BasicTask | BasicTask |
| Bare minimum task object with state tracking and run method. | |
Enumerations | |
| enum | BasicTaskRunResultEnum { TASK_Result_Failure , TASK_Result_Success , TASK_Result_Basic_Count } |
| Return values from BasicTask::run() More... | |
BasicTask is the bare minimum for a task object. It provides only:
BasicTask does not support:
Derive from BasicTask when you need the absolute minimum overhead for simple tasks that just need to run on a worker thread with no dependencies.
| #define btaskCancel | ( | self | ) | (self)->_->cancel(BasicTask(self)) |
bool btaskCancel(BasicTask* self);
Request cancellation of this task.
Definition at line 112 of file basictask.h.
| #define btaskReset | ( | self | ) | (self)->_->reset(BasicTask(self)) |
bool btaskReset(BasicTask* self);
Reset task to initial state so it can be run again.
Definition at line 117 of file basictask.h.
| #define btaskRun | ( | self, | |
| tq, | |||
| worker, | |||
| tcon | |||
| ) | (self)->_->run(BasicTask(self), TaskQueue(tq), TQWorker(worker), tcon) |
uint32 btaskRun(BasicTask* self, TaskQueue* tq, TQWorker* worker, TaskControl* tcon);
Abstract method that derived classes must implement to define task behavior.
This method is called by the task queue system when the task is ready to execute. Do not call this method directly. Derived classes must implement this to provide the actual task logic.
| tq | Task queue this task is running on |
| worker | Worker thread executing this task |
| tcon | TaskControl structure for output parameters |
Definition at line 101 of file basictask.h.
| #define btaskRunCancelled | ( | self, | |
| tq, | |||
| worker | |||
| ) | (self)->_->runCancelled(BasicTask(self), TaskQueue(tq), TQWorker(worker)) |
void btaskRunCancelled(BasicTask* self, TaskQueue* tq, TQWorker* worker);
Called when task is cancelled before it can run.
| tq | Task queue the task was on |
| worker | Worker that picked up the cancelled task |
Definition at line 107 of file basictask.h.
Return values from BasicTask::run()
| Enumerator | |
|---|---|
| TASK_Result_Failure | Task failed, will transition to TASK_Failed state. |
| TASK_Result_Success | Task succeeded, will transition to TASK_Succeeded state. |
Definition at line 40 of file basictask.h.