1 #ifndef HAWKTRACER_TASK_SCHEDULER_H 2 #define HAWKTRACER_TASK_SCHEDULER_H 17 #define HT_TASK_SCHEDULER_INVALID_TASK_ID ((HT_TaskId)-1) Takes delays into account, and restarts the timer for the task after its execution; if task was delay...
Definition: task_scheduler.h:31
#define HT_API
Defines a directive for exporting/importing symbols from DLL.
Definition: macros.h:76
#define HT_DECLS_END
Defines an end of C linkage block.
Definition: macros.h:17
HT_API HT_Boolean ht_task_scheduler_remove_task(HT_TaskScheduler *task_scheduler, HT_TaskId task_id)
Deletes a task from a scheduler.
HT_TaskSchedulingMode
Task scheduling mode.
Definition: task_scheduler.h:22
HT_API HT_TaskId ht_task_scheduler_schedule_task(HT_TaskScheduler *task_scheduler, HT_TaskSchedulingMode mode, HT_DurationNs period, HT_TaskCallback callback, void *user_data)
Adds a new task to a scheduler.
HT_API void ht_task_scheduler_destroy(HT_TaskScheduler *task_scheduler)
Destroys task scheduler data structure.
HT_ErrorCode
Defines list of possible errors returned by library functions.
Definition: base_types.h:48
int HT_Boolean
A standard boolean type, possible values: HT_TRUE, HT_FALSE.
Definition: base_types.h:20
HT_API void ht_task_scheduler_tick(HT_TaskScheduler *task_scheduler)
Executes scheduled tasks when they time out.
int32_t HT_TaskId
A task scheduler's task identifier.
Definition: task_scheduler.h:15
HT_API HT_DurationNs ht_task_scheduler_get_optimal_tick_period(HT_TaskScheduler *task_scheduler)
Gets optimal tick period for scheduled tasks.
Ignores task execution delays; if the task has been run after the timeout, next task execution will b...
Definition: task_scheduler.h:27
HT_API HT_TaskScheduler * ht_task_scheduler_create(HT_ErrorCode *out_err)
Creates an instance of the HT_TaskScheduler structure.
#define HT_DECLS_BEGIN
Defines a beginning of C linkage block.
Definition: macros.h:16
uint64_t HT_DurationNs
An unsigned integer used for representing duration in nanoseconds.
Definition: base_types.h:18
struct _HT_TaskScheduler HT_TaskScheduler
Definition: task_scheduler.h:34
HT_DECLS_BEGIN typedef HT_Boolean(* HT_TaskCallback)(void *user_data)
A task scheduler's callback.
Definition: task_scheduler.h:13