12typedef struct TQRunner TQRunner;
13typedef struct TQRunner_WeakRef TQRunner_WeakRef;
14typedef struct TQManager TQManager;
15typedef struct TQManager_WeakRef TQManager_WeakRef;
16typedef struct TQMonitor TQMonitor;
17typedef struct TQMonitor_WeakRef TQMonitor_WeakRef;
18typedef struct TQWorker TQWorker;
19typedef struct TQWorker_WeakRef TQWorker_WeakRef;
21typedef struct BasicTask_WeakRef BasicTask_WeakRef;
22typedef struct TaskQueue TaskQueue;
23typedef struct TaskQueue_WeakRef TaskQueue_WeakRef;
24typedef struct TQWorker TQWorker;
25typedef struct TQWorker_WeakRef TQWorker_WeakRef;
27typedef struct ComplexTask_WeakRef ComplexTask_WeakRef;
29typedef struct ComplexTask_WeakRef ComplexTask_WeakRef;
31typedef struct TRGate_WeakRef TRGate_WeakRef;
32typedef struct ComplexTaskQueue ComplexTaskQueue;
33typedef struct ComplexTaskQueue_WeakRef ComplexTaskQueue_WeakRef;
35typedef struct ComplexTaskQueue ComplexTaskQueue;
36typedef struct ComplexTaskQueue_WeakRef ComplexTaskQueue_WeakRef;
39#define _sti_ComplexTaskQueue _sti_object
40#define SType_ComplexTaskQueue ComplexTaskQueue*
41#define STStorageType_ComplexTaskQueue ComplexTaskQueue*
42#define STypeArg_ComplexTaskQueue(type, val) stgeneric(object, (ObjInst*)objInstCheckClass(ComplexTaskQueue, val))
43#define STypeArgPtr_ComplexTaskQueue(type, val) (stgeneric*)objInstCheckClassPtr(ComplexTaskQueue, val)
44#define STypeCheckedArg_ComplexTaskQueue(type, val) stType(type), stArg(type, val)
45#define STypeCheckedPtrArg_ComplexTaskQueue(type, val) stType(type), stArgPtr(type, val)
47typedef struct ComplexTaskQueue_ClassIf {
53 bool (*start)(_In_
void* self);
55 bool (*stop)(_In_
void* self, int64 timeout);
57 bool (*add)(_In_
void* self, _In_
BasicTask* btask);
59 int64 (*tick)(_In_
void* self);
61 bool (*_processDone)(_In_
void* self);
63 int64 (*_processExtra)(_In_
void* self,
bool taskscompleted);
65 bool (*_queueMaint)(_In_
void* self);
67 bool (*_runTask)(_In_
void* self, _Inout_
BasicTask** pbtask, _In_ TQWorker* worker);
69 void (*_clear)(_In_
void* self);
71 bool (*schedule)(_In_
void* self, _In_
ComplexTask* task, int64 delay);
73 bool (*defer)(_In_
void* self, _In_
ComplexTask* task);
74 bool (*advance)(_In_
void* self, _In_
ComplexTask* task);
75} ComplexTaskQueue_ClassIf;
76extern ComplexTaskQueue_ClassIf ComplexTaskQueue_ClassIf_tmpl;
78typedef struct ComplexTaskQueue {
80 ComplexTaskQueue_ClassIf* _;
81 void* _is_ComplexTaskQueue;
102 sa_ComplexTask scheduled;
106#define ComplexTaskQueue(inst) objInstCheckClass(ComplexTaskQueue, inst)
107#define ComplexTaskQueueNone ((ComplexTaskQueue*)NULL)
109typedef struct ComplexTaskQueue_WeakRef {
112 void* _is_ComplexTaskQueue_WeakRef;
113 void* _is_TaskQueue_WeakRef;
114 void* _is_ObjInst_WeakRef;
116 atomic(uintptr) _ref;
118} ComplexTaskQueue_WeakRef;
119#define ComplexTaskQueue_WeakRef(inst) objWeakRefCheckClass(ComplexTaskQueue, inst)
121_objfactory_guaranteed ComplexTaskQueue* ComplexTaskQueue_create(_In_opt_ strref name, uint32 flags, int64 gcinterval, _In_ TQRunner* runner, _In_ TQManager* manager, _In_opt_ TQMonitor* monitor);
123#define ctaskqueueCreate(name, flags, gcinterval, runner, manager, monitor) ComplexTaskQueue_create(name, flags, gcinterval, TQRunner(runner), TQManager(manager), TQMonitor(monitor))
128#define ctaskqueueStart(self) (self)->_->start(ComplexTaskQueue(self))
132#define ctaskqueueStop(self, timeout) (self)->_->stop(ComplexTaskQueue(self), timeout)
136#define ctaskqueueAdd(self, btask) (self)->_->add(ComplexTaskQueue(self), BasicTask(btask))
140#define ctaskqueueTick(self) (self)->_->tick(ComplexTaskQueue(self))
144#define ctaskqueue_processDone(self) (self)->_->_processDone(ComplexTaskQueue(self))
148#define ctaskqueue_processExtra(self, taskscompleted) (self)->_->_processExtra(ComplexTaskQueue(self), taskscompleted)
152#define ctaskqueue_queueMaint(self) (self)->_->_queueMaint(ComplexTaskQueue(self))
156#define ctaskqueue_runTask(self, pbtask, worker) (self)->_->_runTask(ComplexTaskQueue(self), pbtask, TQWorker(worker))
160#define ctaskqueue_clear(self) (self)->_->_clear(ComplexTaskQueue(self))
164#define ctaskqueueSchedule(self, task, delay) (self)->_->schedule(ComplexTaskQueue(self), ComplexTask(task), delay)
168#define ctaskqueueDefer(self, task) (self)->_->defer(ComplexTaskQueue(self), ComplexTask(task))
170#define ctaskqueueAdvance(self, task) (self)->_->advance(ComplexTaskQueue(self), ComplexTask(task))
Complex task with dependencies, scheduling, and resource management.
#define saDeclarePtr(name)
#define _objfactory_guaranteed
CX Struct System - Introspectable, serializable POD structures in C.
CX Object System - Object-oriented programming in C.
Bare minimum task object with state tracking and run method.
Complex task with dependencies, scheduling, and resource management.
One-time event gate for task synchronization.