GFXprim
2D bitmap graphics library with emphasis on speed and correctness
|
Application tasks. More...
Go to the source code of this file.
Data Structures | |
struct | gp_task_queue |
A task queue. More... | |
struct | gp_task |
A task. More... | |
Functions | |
void | gp_task_queue_dump (gp_task_queue *self) |
Dumps task queue structure into stdout. | |
void | gp_task_queue_ins (gp_task_queue *self, gp_task *task) |
Inserts a new task into the queue. | |
void | gp_task_queue_rem (gp_task_queue *self, gp_task *task) |
Removes a new task from the queue. | |
int | gp_task_queue_process (gp_task_queue *self) |
Runs a single task in the queue. | |
static size_t | gp_task_queue_tasks (gp_task_queue *self) |
Returns number of tasks in the queue. | |
static unsigned int | gp_task_queue_head_prio (gp_task_queue *self) |
Returns minimal priority from all tasks in the queue. | |
Application tasks.
Tasks a way how to schedulle a short amount of work in the context of the application main loop. Tasks are sorted into queues accordingly to its priorities. Queue with smallest priority runs until it's out of tasks. Tasks inside a single queue are schedulled by a round robin.
Definition in file gp_task.h.
void gp_task_queue_dump | ( | gp_task_queue * | self | ) |
Dumps task queue structure into stdout.
self | A task queue. |
|
inlinestatic |
Returns minimal priority from all tasks in the queue.
self | A task queue. |
Definition at line 128 of file gp_task.h.
References gp_task_queue::min_prio.
void gp_task_queue_ins | ( | gp_task_queue * | self, |
gp_task * | task | ||
) |
Inserts a new task into the queue.
self | A task queue. |
task | A task to be inserted. |
int gp_task_queue_process | ( | gp_task_queue * | self | ) |
Runs a single task in the queue.
Runs a single task from first smaller priority the non-empty queue. When task finishes it's work it is either removed from the queue or is requeued based on the return value from the task callback.
self | A task queue. |
void gp_task_queue_rem | ( | gp_task_queue * | self, |
gp_task * | task | ||
) |
Removes a new task from the queue.
self | A task queue. |
task | A task to be removed. |
|
inlinestatic |
Returns number of tasks in the queue.
self | A task queue. |
Definition at line 115 of file gp_task.h.
References gp_task_queue::task_cnt.