|  | libgpac
    Documentation of the core library of GPAC | 
Thread processing. More...
 Collaboration diagram for Thread:
 Collaboration diagram for Thread:| Macros | |
| #define | safe_int_inc(__v) __sync_add_and_fetch((int *) (__v), 1) | 
| #define | safe_int_dec(__v) __sync_sub_and_fetch((int *) (__v), 1) | 
| #define | safe_int_add(__v, inc_val) __sync_add_and_fetch((int *) (__v), inc_val) | 
| #define | safe_int_sub(__v, dec_val) __sync_sub_and_fetch((int *) (__v), dec_val) | 
| #define | safe_int64_add(__v, inc_val) __sync_add_and_fetch((int64_t *) (__v), inc_val) | 
| #define | safe_int64_sub(__v, dec_val) __sync_sub_and_fetch((int64_t *) (__v), dec_val) | 
| Typedefs | |
| typedef u32(* | gf_thread_run) (void *par) | 
| thread run function callback | |
| Enumerations | |
| enum | { GF_THREAD_STATUS_STOP = 0 , GF_THREAD_STATUS_RUN = 1 , GF_THREAD_STATUS_DEAD = 2 } | 
| Thread states.  More... | |
| enum | { GF_THREAD_PRIORITY_IDLE =0 , GF_THREAD_PRIORITY_LESS_IDLE , GF_THREAD_PRIORITY_LOWEST , GF_THREAD_PRIORITY_LOW , GF_THREAD_PRIORITY_NORMAL , GF_THREAD_PRIORITY_HIGH , GF_THREAD_PRIORITY_HIGHEST , GF_THREAD_PRIORITY_REALTIME , GF_THREAD_PRIORITY_REALTIME_END =255 } | 
| Functions | |
| GF_Thread * | gf_th_new (const char *name) | 
| thread constructor | |
| void | gf_th_del (GF_Thread *th) | 
| thread destructor | |
| GF_Err | gf_th_run (GF_Thread *th, gf_thread_run run, void *par) | 
| thread execution | |
| void | gf_th_stop (GF_Thread *th) | 
| thread stopping | |
| u32 | gf_th_status (GF_Thread *th) | 
| thread status query | |
| void | gf_th_set_priority (GF_Thread *th, s32 priority) | 
| thread priority | |
| u32 | gf_th_id () | 
| current thread ID | |
Thread processing.
The thread object allows executing some code independently of the main process of your application.
| #define safe_int_inc | ( | __v | ) | __sync_add_and_fetch((int *) (__v), 1) | 
atomic integer increment
| #define safe_int_dec | ( | __v | ) | __sync_sub_and_fetch((int *) (__v), 1) | 
atomic integer decrement
| #define safe_int_add | ( | __v, | |
| inc_val | |||
| ) | __sync_add_and_fetch((int *) (__v), inc_val) | 
atomic integer addition
| #define safe_int_sub | ( | __v, | |
| dec_val | |||
| ) | __sync_sub_and_fetch((int *) (__v), dec_val) | 
atomic integer subtraction
| #define safe_int64_add | ( | __v, | |
| inc_val | |||
| ) | __sync_add_and_fetch((int64_t *) (__v), inc_val) | 
atomic large integer addition
| #define safe_int64_sub | ( | __v, | |
| dec_val | |||
| ) | __sync_sub_and_fetch((int64_t *) (__v), dec_val) | 
atomic large integer subtraction
| typedef u32(* gf_thread_run) (void *par) | 
thread run function callback
The gf_thread_run type is the type for the callback of the gf_thread_run function
| par | opaque user data | 
| anonymous enum | 
| anonymous enum | 
thread priorities
| GF_Thread * gf_th_new | ( | const char * | name | ) | 
thread constructor
Constructs a new thread object
| name | log name of the thread if any | 
 Here is the call graph for this function:
 Here is the call graph for this function: Here is the caller graph for this function:
 Here is the caller graph for this function:| void gf_th_del | ( | GF_Thread * | th | ) | 
thread destructor
Kills the thread if running and destroys the object
| th | the thread object | 
 Here is the call graph for this function:
 Here is the call graph for this function: Here is the caller graph for this function:
 Here is the caller graph for this function:| GF_Err gf_th_run | ( | GF_Thread * | th, | 
| gf_thread_run | run, | ||
| void * | par | ||
| ) | 
thread execution
Executes the thread with the given function
| th | the thread object | 
| run | the function this thread will call | 
| par | the argument to the function the thread will call | 
 Here is the caller graph for this function:
 Here is the caller graph for this function:| void gf_th_stop | ( | GF_Thread * | th | ) | 
thread stopping
Waits for the thread exit until return
| th | the thread object | 
 Here is the call graph for this function:
 Here is the call graph for this function: Here is the caller graph for this function:
 Here is the caller graph for this function:| u32 gf_th_status | ( | GF_Thread * | th | ) | 
thread status query
Gets the thread status
| th | the thread object | 
 Here is the caller graph for this function:
 Here is the caller graph for this function:| void gf_th_set_priority | ( | GF_Thread * | th, | 
| s32 | priority | ||
| ) | 
thread priority
Sets the thread execution priority level.
| th | the thread object | 
| priority | the desired priority | 
 Here is the caller graph for this function:
 Here is the caller graph for this function:| u32 gf_th_id | ( | ) | 
current thread ID
Gets the ID of the current thread the caller is in.
 Here is the caller graph for this function:
 Here is the caller graph for this function: