VLC 4.0.0-dev
Loading...
Searching...
No Matches
threads.c File Reference
Include dependency graph for threads.c:

Data Structures

struct  vlc_suuint
 
struct  vlc_cond_waiter
 

Enumerations

enum  { VLC_LATCH_READY , VLC_LATCH_CONTEND , VLC_LATCH_PENDING }
 
enum  { VLC_ONCE_UNDONE , VLC_ONCE_DOING , VLC_ONCE_CONTEND , VLC_ONCE_DONE }
 

Functions

void vlc_global_mutex (unsigned n, bool acquire)
 Internal handler for global mutexes.
 
static void vlc_mutex_init_common (vlc_mutex_t *mtx, bool recursive)
 
void vlc_mutex_init (vlc_mutex_t *mtx)
 Initializes a fast mutex.
 
void vlc_mutex_init_recursive (vlc_mutex_t *mtx)
 Initializes a recursive mutex.
 
bool vlc_mutex_held (const vlc_mutex_t *mtx)
 Checks if a mutex is locked.
 
void vlc_mutex_lock (vlc_mutex_t *mtx)
 Acquires a mutex.
 
int vlc_mutex_trylock (vlc_mutex_t *mtx)
 Tries to acquire a mutex.
 
void vlc_mutex_unlock (vlc_mutex_t *mtx)
 Releases a mutex.
 
void vlc_cond_init (vlc_cond_t *cond)
 Initializes a condition variable.
 
static void vlc_cond_signal_waiter (struct vlc_cond_waiter *waiter)
 
void vlc_cond_signal (vlc_cond_t *cond)
 Wakes up one thread waiting on a condition variable.
 
void vlc_cond_broadcast (vlc_cond_t *cond)
 Wakes up all threads waiting on a condition variable.
 
static void vlc_cond_wait_prepare (struct vlc_cond_waiter *waiter, vlc_cond_t *cond, vlc_mutex_t *mutex)
 
static void vlc_cond_wait_finish (struct vlc_cond_waiter *waiter, vlc_cond_t *cond, vlc_mutex_t *mutex)
 
void vlc_cond_wait (vlc_cond_t *cond, vlc_mutex_t *mutex)
 Waits on a condition variable.
 
int vlc_cond_timedwait (vlc_cond_t *cond, vlc_mutex_t *mutex, vlc_tick_t deadline)
 Waits on a condition variable up to a certain date.
 
int vlc_cond_timedwait_daytime (vlc_cond_t *cond, vlc_mutex_t *mutex, time_t deadline)
 
void vlc_sem_init (vlc_sem_t *sem, unsigned value)
 Initializes a semaphore.
 
int vlc_sem_post (vlc_sem_t *sem)
 Increments the value of a semaphore.
 
void vlc_sem_wait (vlc_sem_t *sem)
 Waits on a semaphore.
 
int vlc_sem_timedwait (vlc_sem_t *sem, vlc_tick_t deadline)
 Waits on a semaphore within a deadline.
 
int vlc_sem_trywait (vlc_sem_t *sem)
 Tries to decrement a semaphore.
 
void vlc_latch_init (vlc_latch_t *latch, size_t value)
 Initializes a latch.
 
static bool vlc_latch_count_down_ready (vlc_latch_t *latch, size_t n)
 
void vlc_latch_count_down (vlc_latch_t *latch, size_t n)
 Decrements the value of a latch.
 
void vlc_latch_count_down_and_wait (vlc_latch_t *latch, size_t n)
 Decrements the value of a latch and waits on it.
 
bool vlc_latch_is_ready (const vlc_latch_t *latch)
 Checks if a latch is ready.
 
void vlc_latch_wait (vlc_latch_t *latch)
 Waits on a latch.
 
void vlc_queuedmutex_init (vlc_queuedmutex_t *m)
 
bool vlc_queuedmutex_held (vlc_queuedmutex_t *m)
 Checks if a queued mutex is locked.
 
void vlc_queuedmutex_lock (vlc_queuedmutex_t *m)
 
void vlc_queuedmutex_unlock (vlc_queuedmutex_t *m)
 
bool() vlc_once_begin (vlc_once_t *restrict once)
 Begins a one-time initialization.
 
void vlc_once_complete (vlc_once_t *restrict once)
 Completes a one-time initialization.
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
VLC_LATCH_READY 
VLC_LATCH_CONTEND 
VLC_LATCH_PENDING 

◆ anonymous enum

anonymous enum
Enumerator
VLC_ONCE_UNDONE 
VLC_ONCE_DOING 
VLC_ONCE_CONTEND 
VLC_ONCE_DONE 

Function Documentation

◆ vlc_cond_signal_waiter()

static void vlc_cond_signal_waiter ( struct vlc_cond_waiter waiter)
static

◆ vlc_cond_timedwait_daytime()

int vlc_cond_timedwait_daytime ( vlc_cond_t cond,
vlc_mutex_t mutex,
time_t  deadline 
)

◆ vlc_cond_wait_finish()

static void vlc_cond_wait_finish ( struct vlc_cond_waiter waiter,
vlc_cond_t cond,
vlc_mutex_t mutex 
)
static

◆ vlc_cond_wait_prepare()

◆ vlc_latch_count_down_ready()

static bool vlc_latch_count_down_ready ( vlc_latch_t latch,
size_t  n 
)
static

◆ vlc_mutex_init_common()

static void vlc_mutex_init_common ( vlc_mutex_t mtx,
bool  recursive 
)
static

◆ vlc_queuedmutex_held()

bool vlc_queuedmutex_held ( vlc_queuedmutex_t m)

Checks if a queued mutex is locked.

This function checks if the calling thread holds a given queued mutual exclusion lock. It has no side effects and is essentially intended for run-time debugging.

Note
To assert that the calling thread holds a lock, the helper macro vlc_queuedmutex_assert() should be used instead of this function.
Return values
falsethe mutex is not locked by the calling thread
truethe mutex is locked by the calling thread

References vlc_queuedmutex_t::owner, and vlc_thread_id().

◆ vlc_queuedmutex_init()

void vlc_queuedmutex_init ( vlc_queuedmutex_t m)

◆ vlc_queuedmutex_lock()

◆ vlc_queuedmutex_unlock()