|
KallistiOS git master
Independent SDK for the Sega Dreamcast
|
Threaded work queue support. More...
Go to the source code of this file.
Data Structures | |
| struct | workqueue_job_t |
| Structure describing a job for the work queue. More... | |
Typedefs | |
| typedef struct workqueue | workqueue_t |
Functions | |
| workqueue_t * | workqueue_create (void) |
| Create a new work queue. | |
| void | workqueue_destroy (workqueue_t *wq) |
| Destroy a work queue. | |
| void | workqueue_kill (workqueue_t *wq) |
| Stop a work queue from running. | |
| void | workqueue_enqueue (workqueue_t *wq, workqueue_job_t *job) |
| Enqueue a job to a work queue. | |
| void | workqueue_cancel (workqueue_t *wq, workqueue_job_t *job) |
| Cancel a job and remove it from the work queue. | |
| kthread_t * | workqueue_get_thread (workqueue_t *wq) |
| Get a handle to the underlying thread. | |
Threaded work queue support.
This file contains the API to create and manage work queues.
A work queue is a thread that will execute tasks (aka. jobs) that are enqueued by client code, at a predeterminated moment in time. Multiple jobs can be enqueued. Once a job is executed, it is removed from the execution queue.
| typedef struct workqueue workqueue_t |
| void workqueue_cancel | ( | workqueue_t * | wq, |
| workqueue_job_t * | job ) |
Cancel a job and remove it from the work queue.
This function can be used when a job should be removed from a work queue before the job is set to be executed (note that jobs are automatically removed from the work queue right before their execution).
| wq | A pointer to the work queue |
| job | A pointer to the job to cancel |
| workqueue_t * workqueue_create | ( | void | ) |
Create a new work queue.
This function will create a new work queue.
| void workqueue_destroy | ( | workqueue_t * | wq | ) |
Destroy a work queue.
This function will destroy a work queue and free up any allocated memory.
| wq | A pointer to the work queue |
| void workqueue_enqueue | ( | workqueue_t * | wq, |
| workqueue_job_t * | job ) |
Enqueue a job to a work queue.
This function will enqueue a job to the given work queue. The job's struct must have been initialized properly.
| wq | A pointer to the work queue |
| job | A pointer to the job to enqueue |
| kthread_t * workqueue_get_thread | ( | workqueue_t * | wq | ) |
Get a handle to the underlying thread.
| wq | The workqueue whose thread should be returned. |
| void workqueue_kill | ( | workqueue_t * | wq | ) |
Stop a work queue from running.
This function can optionally be called before destroying a work queue. The work queue then stops processing previously or newly enqueued jobs.
| wq | A pointer to the work queue |