KallistiOS git master
Independent SDK for the Sega Dreamcast
|
Opaque structure describing one worker thread. More...
#include <worker_thread.h>
Related Symbols | |
(Note that these are not member symbols.) | |
kthread_worker_t * | thd_worker_create_ex (const kthread_attr_t *attr, void(*routine)(void *), void *data) |
Create a new worker thread with the specific set of attributes. | |
static kthread_worker_t * | thd_worker_create (void(*routine)(void *), void *data) |
Create a new worker thread. | |
void | thd_worker_destroy (kthread_worker_t *thd) |
Stop and destroy a worker thread. | |
void | thd_worker_wakeup (kthread_worker_t *thd) |
Wake up a worker thread. | |
kthread_t * | thd_worker_get_thread (kthread_worker_t *thd) |
Get a handle to the underlying thread. | |
void | thd_worker_add_job (kthread_worker_t *thd, kthread_job_t *job) |
Add a new job to the worker thread. | |
kthread_job_t * | thd_worker_dequeue_job (kthread_worker_t *worker) |
Dequeue one job from the worker thread's to-do queue. | |
Opaque structure describing one worker thread.
|
related |
Add a new job to the worker thread.
This function will append the job to the worker thread's to-do queue. Note that it is the responsability of the work function (the one passed to thd_worker_create()) to dequeue and process the jobs with thd_worker_dequeue_job(). Also, this function won't automatically notify the worker thread - you still need to call thd_worker_wakeup().
thd | The worker thread to add a job to. |
job | The new job to give to the worker thread. |
|
related |
Create a new worker thread.
This function will create a thread with the default attributes that will call the given routine with the given param pointer when notified. The thread will only stop when thd_worker_destroy() is called.
routine | The function to call in the worker thread. |
data | A parameter to pass to the function called. |
References thd_worker_create_ex().
|
related |
Create a new worker thread with the specific set of attributes.
This function will create a thread with the specified attributes that will call the given routine with the given param pointer when notified. The thread will only stop when thd_worker_destroy() is called.
attr | A set of thread attributes for the created thread. Passing NULL will initialize all attributes to their default values. |
routine | The function to call in the worker thread. |
data | A parameter to pass to the function called. |
|
related |
Dequeue one job from the worker thread's to-do queue.
Use this function to dequeue one job from the worker thread, that has been previously queued using thd_worker_add_job(). This function is typically used inside the work function registered with thd_worker_create().
worker | The worker thread to add a job to. |
|
related |
Stop and destroy a worker thread.
This function will stop the worker thread and free its memory.
thd | The worker thread to destroy. |
|
related |
Get a handle to the underlying thread.
thd | The worker thread whose handle should be returned. |
|
related |
Wake up a worker thread.
This function will wake up the worker thread, causing it to call its corresponding work function. Usually, this should be called after a new job has been added with thd_worker_add_job().
thd | The worker thread to wake up. |