libgpac
Documentation of the core library of GPAC
os_thread.c File Reference
#include <gpac/thread.h>
#include <sched.h>
#include <pthread.h>
#include <semaphore.h>
#include <errno.h>
#include <gpac/list.h>
+ Include dependency graph for os_thread.c:

Data Structures

struct  GF_Thread
 abstracted thread object More...
 
struct  GF_Mutex
 abstracted mutex object More...
 
struct  GF_Semaphore
 abstracted semaphore object More...
 

Typedefs

typedef pthread_t TH_HANDLE
 

Functions

static void log_add_thread (GF_Thread *t)
 
static void log_del_thread (GF_Thread *t)
 
static const char * log_th_name (u32 id, char szName[100])
 
const char * gf_th_log_name (GF_Thread *t)
 
GF_EXPORT GF_Thread * gf_th_new (const char *name)
 thread constructor More...
 
void * RunThread (void *ptr)
 
GF_EXPORT GF_Err gf_th_run (GF_Thread *t, u32(*Run)(void *param), void *param)
 
void Thread_Stop (GF_Thread *t, Bool Destroy)
 
GF_EXPORT void gf_th_stop (GF_Thread *t)
 thread stopping More...
 
GF_EXPORT void gf_th_del (GF_Thread *t)
 thread destructor More...
 
GF_EXPORT void gf_th_set_priority (GF_Thread *t, s32 priority)
 thread priority More...
 
GF_EXPORT u32 gf_th_status (GF_Thread *t)
 thread status query More...
 
GF_EXPORT u32 gf_th_id ()
 current thread ID More...
 
GF_EXPORT GF_Mutex * gf_mx_new (const char *name)
 mutex constructor More...
 
GF_EXPORT void gf_mx_del (GF_Mutex *mx)
 mutex denstructor More...
 
GF_EXPORT void gf_mx_v (GF_Mutex *mx)
 mutex unlocking More...
 
GF_EXPORT u32 gf_mx_p (GF_Mutex *mx)
 mutex locking More...
 
GF_EXPORT s32 gf_mx_get_num_locks (GF_Mutex *mx)
 get mutex number of locks More...
 
GF_EXPORT Bool gf_mx_try_lock (GF_Mutex *mx)
 mutex non-blocking lock More...
 
GF_EXPORT GF_Semaphore * gf_sema_new (u32 MaxCount, u32 InitCount)
 semaphore constructor More...
 
GF_EXPORT void gf_sema_del (GF_Semaphore *sm)
 semaphore destructor More...
 
GF_EXPORT Bool gf_sema_notify (GF_Semaphore *sm, u32 NbRelease)
 semaphore notification. More...
 
GF_EXPORT Bool gf_sema_wait (GF_Semaphore *sm)
 semaphore wait More...
 
GF_EXPORT Bool gf_sema_wait_for (GF_Semaphore *sm, u32 TimeOut)
 semaphore time wait More...
 

Variables

static GF_List * thread_bank = NULL
 
static u32 main_th_id = 0
 

Data Structure Documentation

◆ __tag_mutex

struct __tag_mutex
Data Fields
pthread_mutex_t hMutex
u32 Holder
u32 HolderCount
char * log_name

◆ __tag_semaphore

struct __tag_semaphore
Data Fields
sem_t * hSemaphore
sem_t SemaData

Typedef Documentation

◆ TH_HANDLE

typedef pthread_t TH_HANDLE

Function Documentation

◆ log_add_thread()

static void log_add_thread ( GF_Thread *  t)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ log_del_thread()

static void log_del_thread ( GF_Thread *  t)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ log_th_name()

static const char* log_th_name ( u32  id,
char  szName[100] 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_th_log_name()

const char* gf_th_log_name ( GF_Thread *  t)
+ Here is the caller graph for this function:

◆ RunThread()

void* RunThread ( void *  ptr)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_th_run()

GF_EXPORT GF_Err gf_th_run ( GF_Thread *  t,
u32(*)(void *param)  Run,
void *  param 
)
+ Here is the call graph for this function:

◆ Thread_Stop()

void Thread_Stop ( GF_Thread *  t,
Bool  Destroy 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ thread_bank

GF_List* thread_bank = NULL
static

◆ main_th_id

u32 main_th_id = 0
static