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

Data Structures

struct  TaskQueueThreadPoolConfig
 Thread pool configuration for a task queue. More...
 
struct  TaskQueueMonitorConfig
 Queue monitoring configuration for detecting stalled tasks. More...
 
struct  TaskQueueConfig
 Complete configuration for a task queue. More...
 
struct  TaskControl
 

Typedefs

typedef bool(* TQUICallback) (TaskQueue *tq)
 
typedef struct TaskQueueThreadPoolConfig TaskQueueThreadPoolConfig
 Thread pool configuration for a task queue.
 
typedef struct TaskQueueMonitorConfig TaskQueueMonitorConfig
 Queue monitoring configuration for detecting stalled tasks.
 
typedef struct TaskQueueConfig TaskQueueConfig
 Complete configuration for a task queue.
 
typedef struct TaskControl TaskControl
 

Enumerations

enum  TaskQueueFlagsEnum {
  TQ_ManagerThread = 0x0001 , TQ_Monitor = 0x0002 , TQ_NoComplex = 0x0004 , TQ_Manual = 0x0008 ,
  TQ_Oneshot = 0x0010
}
 Task queue configuration flags. More...
 
enum  TaskStateEnum {
  TASK_Created , TASK_Waiting , TASK_Running , TASK_Scheduled ,
  TASK_Deferred , TASK_Succeeded , TASK_Failed , TASK_State_Mask = 0x7fffffff ,
  TASK_Cancelled = 0x80000000
}
 

Detailed Description

Core types, enums, and configuration structures used throughout the task queue system.

Typedef Documentation

◆ TaskControl

typedef struct TaskControl TaskControl

Task control structure for output parameters from task execution

This structure is passed to task run() methods as an output parameter, allowing tasks to communicate state changes back to the task queue system without affecting the return value.

◆ TQUICallback

typedef bool(* TQUICallback) (TaskQueue *tq)

Callback for UI event processing in task queue workers.

Called by task queue workers when configured to handle UI events. Should return true if all UI events were processed, or false if there are more pending events and the worker should continue looping.

Parameters
tqThe task queue requesting UI processing
Returns
true if all UI events processed, false if more events remain

Definition at line 23 of file taskqueue_shared.h.

Enumeration Type Documentation

◆ TaskQueueFlagsEnum

Task queue configuration flags.

Enumerator
TQ_ManagerThread 

Use a dedicated manager thread for queue maintenance instead of stealing idle worker time.

Without this flag, maintenance (purging completed tasks, releasing deferred tasks) is
scheduled on idle worker threads. With it, a dedicated manager thread performs maintenance
on a schedule and as needed. Recommended for heavy workloads. 
TQ_Monitor 

Enable queue monitoring to detect and report stalled tasks.

Periodically checks the queue for tasks running too long, waiting too long, or deferred
without progress. Emits log messages to help debug queue state issues. 
TQ_NoComplex 

Restrict queue to BasicTask and Task only (no ComplexTask features).

Disables support for complex tasks with dependencies, scheduling, and resources. Uses
simpler code paths with less overhead when these features aren't needed. 
TQ_Manual 

Manual mode - no thread pool, tick() must be called manually.

Disables automatic worker threads. The queue's tick() function must be called explicitly
to process tasks. Not compatible with TQ_ManagerThread or TQ_Monitor. Useful for
integration with existing event loops. 
TQ_Oneshot 

In manual mode, only run one task per tick() call.

Without this flag, tick() runs as many ready tasks as possible. With it, tick() runs
exactly one task per call, which may be desired when interleaving task processing with
other work in a loop. Only relevant in manual mode. 

Definition at line 26 of file taskqueue_shared.h.

◆ TaskStateEnum

Task state values

Task state is stored atomically and can include the TASK_Cancelled flag combined with any state value. Use TASK_State_Mask to extract just the state without the cancelled flag.

Enumerator
TASK_Created 

Task has been created but not yet queued.

TASK_Waiting 

Task is queued and waiting for a worker.

TASK_Running 

Task is currently executing on a worker.

TASK_Scheduled 

Task is scheduled to run at a future time.

TASK_Deferred 

Task is deferred, waiting for explicit advancement.

TASK_Succeeded 

Task completed successfully.

TASK_Failed 

Task failed during execution.

TASK_State_Mask 

Mask to extract state value without flags.

TASK_Cancelled 

Flag indicating task has been cancelled (combines with state)

Definition at line 99 of file taskqueue_shared.h.