VLC  3.0.15
Data Structures | Macros | Typedefs | Enumerations | Functions
Include dependency graph for vlc_threads.h:

Go to the source code of this file.

Data Structures

struct  vlc_thread_t
 Thread handle. 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_MUTEX   PTHREAD_MUTEX_INITIALIZER
 Static initializer for (static) mutex. More...
 
#define VLC_STATIC_COND   PTHREAD_COND_INITIALIZER
 Static initializer for (static) condition variable. 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_HARD_MIN_SLEEP   10000 /* 10 milliseconds = 1 tick at 100Hz */
 
#define VLC_SOFT_MIN_SLEEP   9000000 /* 9 seconds */
 
#define check_delay(d)   (d)
 
#define check_deadline(d)   (d)
 
#define msleep(d)   msleep(check_delay(d))
 
#define mwait(d)   mwait(check_deadline(d))
 
#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_mutex_t vlc_mutex_t
 Mutex. More...
 
typedef pthread_cond_t vlc_cond_t
 Condition variable. More...
 
typedef sem_t vlc_sem_t
 Semaphore. More...
 
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_timervlc_timer_t
 Threaded timer handle. More...
 

Enumerations

enum  { VLC_CLEANUP_PUSH, VLC_CLEANUP_POP, VLC_CANCEL_ADDR_SET, VLC_CANCEL_ADDR_CLEAR }
 
enum  {
  VLC_AVCODEC_MUTEX = 0, VLC_GCRYPT_MUTEX, VLC_XLIB_MUTEX, VLC_MOSAIC_MUTEX,
  VLC_HIGHLIGHT_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_destroy (vlc_mutex_t *)
 Deinitializes a 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...
 
void vlc_cond_init (vlc_cond_t *)
 Initializes a condition variable. More...
 
void vlc_cond_init_daytime (vlc_cond_t *)
 Initializes a condition variable (wall clock). More...
 
void vlc_cond_destroy (vlc_cond_t *)
 Deinitializes 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, mtime_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...
 
void vlc_sem_destroy (vlc_sem_t *)
 Deinitializes 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...
 
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...
 
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_addr_wait (void *addr, unsigned val)
 Waits on an address. More...
 
bool vlc_addr_timedwait (void *addr, unsigned val, mtime_t delay)
 Waits on an address with a time-out. More...
 
void vlc_addr_signal (void *addr)
 Wakes up one thread on an address. More...
 
void vlc_addr_broadcast (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 (int cmd,...)
 Internal handler for thread cancellation. More...
 
vlc_thread_t vlc_thread_self (void)
 Thread handle. More...
 
unsigned long vlc_thread_id (void)
 Thread identifier. More...
 
mtime_t mdate (void)
 Precision monotonic clock. More...
 
void mwait (mtime_t deadline)
 Waits until a deadline. More...
 
void msleep (mtime_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, mtime_t value, mtime_t interval)
 Arms or disarms an initialized timer. More...
 
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)
 
static void vlc_cancel_addr_set (void *addr)
 
static void vlc_cancel_addr_clear (void *addr)
 
void vlc_global_mutex (unsigned, bool)
 Internal handler for global mutexes. More...
 

Detailed Description

Thread primitive declarations