VLC
4.0.0-dev
|
Thread primitive declarations. More...
Go to the source code of this file.
Data Structures | |
struct | vlc_thread_t |
Thread handle. More... | |
struct | vlc_mutex_t |
Mutex. More... | |
struct | vlc_cond_t |
Condition variable. More... | |
struct | vlc_sem_t |
Semaphore. More... | |
struct | vlc_once_t |
One-time initialization. More... | |
Macros | |
#define | LIBVLC_USE_PTHREAD 1 |
Whether LibVLC threads are based on POSIX threads. More... | |
#define | LIBVLC_USE_PTHREAD_CLEANUP 1 |
Whether LibVLC thread cancellation is based on POSIX threads. More... | |
#define | VLC_THREAD_CANCELED PTHREAD_CANCELED |
Return value of a canceled thread. More... | |
#define | VLC_STATIC_RWLOCK PTHREAD_RWLOCK_INITIALIZER |
Static initializer for (static) read/write lock. More... | |
#define | VLC_THREAD_PRIORITY_LOW 0 |
#define | VLC_THREAD_PRIORITY_INPUT 10 |
#define | VLC_THREAD_PRIORITY_AUDIO 5 |
#define | VLC_THREAD_PRIORITY_VIDEO 0 |
#define | VLC_THREAD_PRIORITY_OUTPUT 15 |
#define | VLC_THREAD_PRIORITY_HIGHEST 20 |
#define | VLC_STATIC_MUTEX |
Static initializer for (static) mutex. More... | |
#define | vlc_mutex_assert(m) assert(vlc_mutex_held(m)) |
Asserts that a mutex is locked by the calling thread. More... | |
#define | VLC_STATIC_COND { NULL, VLC_STATIC_MUTEX } |
Static initializer for (static) condition variable. More... | |
#define | VLC_STATIC_ONCE { ATOMIC_VAR_INIT(0) } |
Static initializer for one-time initialization. More... | |
#define | vlc_once(once, cb) vlc_once_inline(once, cb) |
#define | VLC_HARD_MIN_SLEEP VLC_TICK_FROM_MS(10) /* 10 milliseconds = 1 tick at 100Hz */ |
#define | VLC_SOFT_MIN_SLEEP VLC_TICK_FROM_SEC(9) /* 9 seconds */ |
#define | check_delay(d) (d) |
#define | check_deadline(d) (d) |
#define | vlc_tick_sleep(d) vlc_tick_sleep(check_delay(d)) |
#define | vlc_tick_wait(d) vlc_tick_wait(check_deadline(d)) |
#define | VLC_TIMER_DISARM (0) |
#define | VLC_TIMER_FIRE_ONCE (0) |
#define | vlc_cleanup_push(routine, arg) pthread_cleanup_push (routine, arg) |
Registers a thread cancellation handler. More... | |
#define | vlc_cleanup_pop() pthread_cleanup_pop (0) |
Unregisters the last cancellation handler. More... | |
#define | mutex_cleanup_push(lock) vlc_cleanup_push (vlc_cleanup_lock, lock) |
#define | vlc_global_lock(n) vlc_global_mutex(n, true) |
Acquires a global mutex. More... | |
#define | vlc_global_unlock(n) vlc_global_mutex(n, false) |
Releases a global mutex. More... | |
Typedefs | |
typedef pthread_rwlock_t | vlc_rwlock_t |
Read/write lock. More... | |
typedef pthread_key_t | vlc_threadvar_t |
Thread-local key handle. More... | |
typedef struct vlc_timer * | vlc_timer_t |
Threaded timer handle. More... | |
typedef struct vlc_cleanup_t | vlc_cleanup_t |
Enumerations | |
enum | { VLC_AVCODEC_MUTEX = 0, VLC_GCRYPT_MUTEX, VLC_XLIB_MUTEX, VLC_MOSAIC_MUTEX, VLC_MAX_MUTEX } |
Functions | |
void | vlc_testcancel (void) |
Issues an explicit deferred cancellation point. More... | |
void | vlc_mutex_init (vlc_mutex_t *) |
Initializes a fast mutex. More... | |
void | vlc_mutex_init_recursive (vlc_mutex_t *) |
Initializes a recursive mutex. More... | |
void | vlc_mutex_lock (vlc_mutex_t *) |
Acquires a mutex. More... | |
int | vlc_mutex_trylock (vlc_mutex_t *) |
Tries to acquire a mutex. More... | |
void | vlc_mutex_unlock (vlc_mutex_t *) |
Releases a mutex. More... | |
bool | vlc_mutex_held (const vlc_mutex_t *) |
Checks if a mutex is locked. More... | |
void | vlc_cond_init (vlc_cond_t *) |
Initializes a condition variable. More... | |
void | vlc_cond_signal (vlc_cond_t *) |
Wakes up one thread waiting on a condition variable. More... | |
void | vlc_cond_broadcast (vlc_cond_t *) |
Wakes up all threads waiting on a condition variable. More... | |
void | vlc_cond_wait (vlc_cond_t *cond, vlc_mutex_t *mutex) |
Waits on a condition variable. More... | |
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. More... | |
int | vlc_cond_timedwait_daytime (vlc_cond_t *, vlc_mutex_t *, time_t) |
void | vlc_sem_init (vlc_sem_t *, unsigned count) |
Initializes a semaphore. More... | |
int | vlc_sem_post (vlc_sem_t *) |
Increments the value of a semaphore. More... | |
void | vlc_sem_wait (vlc_sem_t *) |
Waits on a semaphore. More... | |
int | vlc_sem_timedwait (vlc_sem_t *sem, vlc_tick_t deadline) |
Waits on a semaphore within a deadline. More... | |
void | vlc_rwlock_init (vlc_rwlock_t *) |
Initializes a read/write lock. More... | |
void | vlc_rwlock_destroy (vlc_rwlock_t *) |
Destroys an initialized unused read/write lock. More... | |
void | vlc_rwlock_rdlock (vlc_rwlock_t *) |
Acquires a read/write lock for reading. More... | |
void | vlc_rwlock_wrlock (vlc_rwlock_t *) |
Acquires a read/write lock for writing. More... | |
void | vlc_rwlock_unlock (vlc_rwlock_t *) |
Releases a read/write lock. More... | |
void | vlc_once_inline (vlc_once_t *restrict once, void(*cb)(void)) |
Executes a function one time. 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 *) |
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) |
Gets the value of a thread-local variable for the calling thread. More... | |
void | vlc_atomic_wait (void *addr, unsigned val) |
Waits on an address. More... | |
int | vlc_atomic_timedwait (void *addr, unsigned val, vlc_tick_t deadline) |
Waits on an address with a time-out. More... | |
int | vlc_atomic_timedwait_daytime (void *addr, unsigned val, time_t deadline) |
void | vlc_atomic_notify_one (void *addr) |
Wakes up one thread on an address. More... | |
void | vlc_atomic_notify_all (void *addr) |
Wakes up all thread on an address. More... | |
int | vlc_clone (vlc_thread_t *th, void *(*entry)(void *), void *data, int priority) |
Creates and starts a new thread. More... | |
void | vlc_cancel (vlc_thread_t) |
Marks a thread as cancelled. More... | |
void | vlc_join (vlc_thread_t th, void **result) |
Waits for a thread to complete (if needed), then destroys it. More... | |
int | vlc_savecancel (void) |
Disables thread cancellation. More... | |
void | vlc_restorecancel (int state) |
Restores the cancellation state. More... | |
void | vlc_control_cancel (vlc_cleanup_t *) |
Internal handler for thread cancellation. More... | |
unsigned long | vlc_thread_id (void) |
Thread identifier. More... | |
vlc_tick_t | vlc_tick_now (void) |
Precision monotonic clock. More... | |
void | vlc_tick_wait (vlc_tick_t deadline) |
Waits until a deadline. More... | |
void | vlc_tick_sleep (vlc_tick_t delay) |
Waits for an interval of time. More... | |
int | vlc_timer_create (vlc_timer_t *id, void(*func)(void *), void *data) |
Initializes an asynchronous timer. More... | |
void | vlc_timer_destroy (vlc_timer_t timer) |
Destroys an initialized timer. More... | |
void | vlc_timer_schedule (vlc_timer_t timer, bool absolute, vlc_tick_t value, vlc_tick_t interval) |
Arms or disarms an initialized timer. More... | |
static void | vlc_timer_disarm (vlc_timer_t timer) |
static void | vlc_timer_schedule_asap (vlc_timer_t timer, vlc_tick_t interval) |
unsigned | vlc_timer_getoverrun (vlc_timer_t) |
Fetches and resets the overrun counter for a timer. More... | |
unsigned | vlc_GetCPUCount (void) |
Count CPUs. More... | |
static void | vlc_cleanup_lock (void *lock) |
void | vlc_cancel_addr_set (atomic_uint *addr) |
void | vlc_cancel_addr_clear (atomic_uint *addr) |
void | vlc_global_mutex (unsigned, bool) |
Internal handler for global mutexes. More... | |
Thread primitive declarations.