|
CX Framework
Cross-platform C utility framework
|
Data Structures | |
| struct | Task |
| Task with name, timing information, and completion callbacks. More... | |
Macros | |
| #define | ftaskRun(self, tq, worker, tcon) (self)->_->run(Task(self), TaskQueue(tq), TQWorker(worker), tcon) |
| #define | ftaskRunCancelled(self, tq, worker) (self)->_->runCancelled(Task(self), TaskQueue(tq), TQWorker(worker)) |
| #define | ftaskCancel(self) (self)->_->cancel(Task(self)) |
| #define | ftaskWait(self, timeout) (self)->_->wait(Task(self), timeout) |
Typedefs | |
| typedef struct Task | Task |
| Task with name, timing information, and completion callbacks. | |
Task extends BasicTask with additional features:
This is the base class for most practical task implementations. Use Task instead of BasicTask when you need to track task identity, timing, or be notified of completion.
For tasks with dependencies, scheduling, or resource requirements, see ComplexTask.
| #define ftaskCancel | ( | self | ) | (self)->_->cancel(Task(self)) |
bool ftaskCancel(Task* self);
Request cancellation of this task.
| #define ftaskRun | ( | self, | |
| tq, | |||
| worker, | |||
| tcon | |||
| ) | (self)->_->run(Task(self), TaskQueue(tq), TQWorker(worker), tcon) |
uint32 ftaskRun(Task* 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 |
| #define ftaskRunCancelled | ( | self, | |
| tq, | |||
| worker | |||
| ) | (self)->_->runCancelled(Task(self), TaskQueue(tq), TQWorker(worker)) |
void ftaskRunCancelled(Task* 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 |
| #define ftaskWait | ( | self, | |
| timeout | |||
| ) | (self)->_->wait(Task(self), timeout) |
bool ftaskWait(Task* self, int64 timeout);
Wait for this task to complete.
| timeout | Maximum time to wait, or 0 to wait indefinitely |