VLC  3.0.21
Macros | Functions | Variables
thread.c File Reference
Include dependency graph for thread.c:

Macros

#define vlc_clock_setup()   pthread_once(&vlc_clock_once, vlc_clock_setup_once)
 
#define VLC_THREAD_ASSERT(action)
 
#define RUNNING_ON_VALGRIND   (0)
 
#define VLC_STACKSIZE   (128 * sizeof (void *) * 1024)
 

Functions

static void vlc_clock_setup_once (void)
 
static struct timespec mtime_to_ts (vlc_tick_t date)
 
void vlc_trace (const char *fn, const char *file, unsigned line)
 
static void vlc_thread_fatal (const char *action, int error, const char *function, const char *file, unsigned line)
 
void vlc_mutex_init (vlc_mutex_t *p_mutex)
 Initializes a fast mutex. More...
 
void vlc_mutex_init_recursive (vlc_mutex_t *p_mutex)
 Initializes a recursive mutex. More...
 
void vlc_mutex_destroy (vlc_mutex_t *p_mutex)
 Deinitializes a mutex. More...
 
void vlc_assert_locked (vlc_mutex_t *p_mutex)
 
void vlc_mutex_lock (vlc_mutex_t *p_mutex)
 Acquires a mutex. More...
 
int vlc_mutex_trylock (vlc_mutex_t *p_mutex)
 Tries to acquire a mutex. More...
 
void vlc_mutex_unlock (vlc_mutex_t *p_mutex)
 Releases a mutex. More...
 
void vlc_cond_init (vlc_cond_t *p_condvar)
 Initializes a condition variable. More...
 
void vlc_cond_init_daytime (vlc_cond_t *p_condvar)
 Initializes a condition variable (wall clock). More...
 
void vlc_cond_destroy (vlc_cond_t *p_condvar)
 Deinitializes a condition variable. More...
 
void vlc_cond_signal (vlc_cond_t *p_condvar)
 Wakes up one thread waiting on a condition variable. More...
 
void vlc_cond_broadcast (vlc_cond_t *p_condvar)
 Wakes up all threads waiting on a condition variable. More...
 
void vlc_cond_wait (vlc_cond_t *p_condvar, vlc_mutex_t *p_mutex)
 Waits on a condition variable. More...
 
int vlc_cond_timedwait (vlc_cond_t *p_condvar, vlc_mutex_t *p_mutex, vlc_tick_t deadline)
 Waits on a condition variable up to a certain date. More...
 
int vlc_cond_timedwait_daytime (vlc_cond_t *p_condvar, vlc_mutex_t *p_mutex, time_t deadline)
 
void vlc_sem_init (vlc_sem_t *sem, unsigned value)
 Initializes a semaphore. More...
 
void vlc_sem_destroy (vlc_sem_t *sem)
 Deinitializes a semaphore. More...
 
int vlc_sem_post (vlc_sem_t *sem)
 Increments the value of a semaphore. More...
 
void vlc_sem_wait (vlc_sem_t *sem)
 Waits on a semaphore. More...
 
void vlc_rwlock_init (vlc_rwlock_t *lock)
 Initializes a read/write lock. More...
 
void vlc_rwlock_destroy (vlc_rwlock_t *lock)
 Destroys an initialized unused read/write lock. More...
 
void vlc_rwlock_rdlock (vlc_rwlock_t *lock)
 Acquires a read/write lock for reading. More...
 
void vlc_rwlock_wrlock (vlc_rwlock_t *lock)
 Acquires a read/write lock for writing. More...
 
void vlc_rwlock_unlock (vlc_rwlock_t *lock)
 Releases a read/write lock. More...
 
int vlc_threadvar_create (vlc_threadvar_t *key, void(*destr)(void *))
 Allocates a thread-specific variable. More...
 
void vlc_threadvar_delete (vlc_threadvar_t *p_tls)
 Deallocates a thread-specific variable. More...
 
int vlc_threadvar_set (vlc_threadvar_t key, void *value)
 Sets a thread-specific variable. More...
 
void * vlc_threadvar_get (vlc_threadvar_t key)
 Gets the value of a thread-local variable for the calling thread. More...
 
void vlc_threads_setup (libvlc_int_t *p_libvlc)
 
static int vlc_clone_attr (vlc_thread_t *th, pthread_attr_t *attr, void *(*entry)(void *), void *data, int priority)
 
int vlc_clone (vlc_thread_t *th, void *(*entry)(void *), void *data, int priority)
 Creates and starts a new thread. More...
 
void vlc_join (vlc_thread_t handle, void **result)
 Waits for a thread to complete (if needed), then destroys it. More...
 
int vlc_clone_detach (vlc_thread_t *th, void *(*entry)(void *), void *data, int priority)
 
vlc_thread_t vlc_thread_self (void)
 Thread handle. More...
 
unsigned long vlc_thread_id (void)
 Thread identifier. More...
 
int vlc_set_priority (vlc_thread_t th, int priority)
 
void vlc_cancel (vlc_thread_t thread_id)
 Marks a thread as cancelled. More...
 
int vlc_savecancel (void)
 Disables thread cancellation. More...
 
void vlc_restorecancel (int state)
 Restores the cancellation state. More...
 
void vlc_testcancel (void)
 Issues an explicit deferred cancellation point. More...
 
void vlc_control_cancel (int cmd,...)
 Internal handler for thread cancellation. More...
 
vlc_tick_t mdate (void)
 Precision monotonic clock. More...
 
void mwait (vlc_tick_t deadline)
 Waits until a deadline. More...
 
void msleep (vlc_tick_t delay)
 Waits for an interval of time. More...
 
unsigned vlc_GetCPUCount (void)
 Count CPUs. More...
 

Variables

static mach_timebase_info_data_t vlc_clock_conversion_factor
 
static pthread_once_t vlc_clock_once = PTHREAD_ONCE_INIT
 

Macro Definition Documentation

◆ RUNNING_ON_VALGRIND

#define RUNNING_ON_VALGRIND   (0)

◆ vlc_clock_setup

#define vlc_clock_setup ( )    pthread_once(&vlc_clock_once, vlc_clock_setup_once)

◆ VLC_STACKSIZE

#define VLC_STACKSIZE   (128 * sizeof (void *) * 1024)

◆ VLC_THREAD_ASSERT

#define VLC_THREAD_ASSERT (   action)
Value:
if (unlikely(val)) \
vlc_thread_fatal (action, val, __func__, __FILE__, __LINE__)

Function Documentation

◆ mtime_to_ts()

static struct timespec mtime_to_ts ( vlc_tick_t  date)
static

◆ vlc_assert_locked()

void vlc_assert_locked ( vlc_mutex_t p_mutex)

References RUNNING_ON_VALGRIND.

◆ vlc_clock_setup_once()

static void vlc_clock_setup_once ( void  )
static

◆ vlc_clone_attr()

static int vlc_clone_attr ( vlc_thread_t th,
pthread_attr_t *  attr,
void *(*)(void *)  entry,
void *  data,
int  priority 
)
static

References VLC_STACKSIZE.

Referenced by vlc_clone(), and vlc_clone_detach().

◆ vlc_clone_detach()

int vlc_clone_detach ( vlc_thread_t th,
void *(*)(void *)  entry,
void *  data,
int  priority 
)

References vlc_clone_attr().

◆ vlc_set_priority()

int vlc_set_priority ( vlc_thread_t  th,
int  priority 
)

< No error

References VLC_SUCCESS.

◆ vlc_thread_fatal()

static void vlc_thread_fatal ( const char *  action,
int  error,
const char *  function,
const char *  file,
unsigned  line 
)
static

◆ vlc_threads_setup()

void vlc_threads_setup ( libvlc_int_t p_libvlc)

◆ vlc_trace()

void vlc_trace ( const char *  fn,
const char *  file,
unsigned  line 
)

Referenced by vlc_thread_fatal().

Variable Documentation

◆ vlc_clock_conversion_factor

mach_timebase_info_data_t vlc_clock_conversion_factor
static

Referenced by mdate(), and vlc_clock_setup_once().

◆ vlc_clock_once

pthread_once_t vlc_clock_once = PTHREAD_ONCE_INIT
static
unlikely
#define unlikely(p)
Definition: vlc_common.h:114