CX Framework
Cross-platform C utility framework
Loading...
Searching...
No Matches

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.
 

Detailed Description

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.

Macro Definition Documentation

◆ ftaskCancel

#define ftaskCancel (   self)    (self)->_->cancel(Task(self))

bool ftaskCancel(Task* self);

Request cancellation of this task.

Returns
true if cancellation was set

Definition at line 109 of file task.h.

◆ ftaskRun

#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.

Parameters
tqTask queue this task is running on
workerWorker thread executing this task
tconTaskControl structure for output parameters
Returns
TASK_Result_Success or TASK_Result_Failure

Definition at line 98 of file task.h.

◆ ftaskRunCancelled

#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.

Parameters
tqTask queue the task was on
workerWorker that picked up the cancelled task

Definition at line 104 of file task.h.

◆ ftaskWait

#define ftaskWait (   self,
  timeout 
)    (self)->_->wait(Task(self), timeout)

bool ftaskWait(Task* self, int64 timeout);

Wait for this task to complete.

Parameters
timeoutMaximum time to wait, or 0 to wait indefinitely
Returns
true if task completed within timeout

Definition at line 117 of file task.h.