libgpac
Documentation of the core library of GPAC
thread.h File Reference

Threading and Mutual Exclusion. More...

#include <gpac/tools.h>
+ Include dependency graph for thread.h:
+ This graph shows which files directly or indirectly include this file:

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 More...
 
typedef struct __tag_thread GF_Thread
 abstracted thread object
 
typedef struct __tag_mutex GF_Mutex
 abstracted mutex object
 
typedef struct __tag_semaphore GF_Semaphore
 abstracted semaphore object
 

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_Threadgf_th_new (const char *name)
 thread constructor More...
 
void gf_th_del (GF_Thread *th)
 thread destructor More...
 
GF_Err gf_th_run (GF_Thread *th, gf_thread_run run, void *par)
 thread execution More...
 
void gf_th_stop (GF_Thread *th)
 thread stopping More...
 
u32 gf_th_status (GF_Thread *th)
 thread status query More...
 
void gf_th_set_priority (GF_Thread *th, s32 priority)
 thread priority More...
 
u32 gf_th_id ()
 current thread ID More...
 
GF_Mutexgf_mx_new (const char *name)
 mutex constructor More...
 
void gf_mx_del (GF_Mutex *mx)
 mutex denstructor More...
 
u32 gf_mx_p (GF_Mutex *mx)
 mutex locking More...
 
void gf_mx_v (GF_Mutex *mx)
 mutex unlocking More...
 
Bool gf_mx_try_lock (GF_Mutex *mx)
 mutex non-blocking lock More...
 
s32 gf_mx_get_num_locks (GF_Mutex *mx)
 get mutex number of locks More...
 
GF_Semaphoregf_sema_new (u32 MaxCount, u32 InitCount)
 semaphore constructor More...
 
void gf_sema_del (GF_Semaphore *sm)
 semaphore destructor More...
 
Bool gf_sema_notify (GF_Semaphore *sm, u32 nb_rel)
 semaphore notification. More...
 
Bool gf_sema_wait (GF_Semaphore *sm)
 semaphore wait More...
 
Bool gf_sema_wait_for (GF_Semaphore *sm, u32 time_out)
 semaphore time wait More...
 

Detailed Description

>