QVisu
Qt-based visualization for smart homes
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
vlc_threads.h File Reference
#include <unistd.h>
#include <pthread.h>
#include <semaphore.h>

Go to the source code of this file.

Macros

#define LIBVLC_USE_PTHREAD   1
 
#define LIBVLC_USE_PTHREAD_CLEANUP   1
 
#define LIBVLC_USE_PTHREAD_CANCEL   1
 
#define VLC_STATIC_MUTEX   PTHREAD_MUTEX_INITIALIZER
 
#define VLC_STATIC_COND   PTHREAD_COND_INITIALIZER
 
#define VLC_STATIC_RWLOCK   PTHREAD_RWLOCK_INITIALIZER
 
#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)
 
#define vlc_cleanup_pop()   pthread_cleanup_pop (0)
 
#define vlc_cleanup_run()   pthread_cleanup_pop (1)
 
#define mutex_cleanup_push(lock)   vlc_cleanup_push (vlc_cleanup_lock, lock)
 
#define vlc_global_lock(n)   vlc_global_mutex( n, true )
 
#define vlc_global_unlock(n)   vlc_global_mutex( n, false )
 

Typedefs

typedef pthread_t vlc_thread_t
 
typedef pthread_mutex_t vlc_mutex_t
 
typedef pthread_cond_t vlc_cond_t
 
typedef sem_t vlc_sem_t
 
typedef pthread_rwlock_t vlc_rwlock_t
 
typedef pthread_key_t vlc_threadvar_t
 
typedef struct vlc_timer * vlc_timer_t
 

Enumerations

enum  {
  VLC_AVCODEC_MUTEX = 0, VLC_GCRYPT_MUTEX, VLC_XLIB_MUTEX, VLC_MOSAIC_MUTEX,
  VLC_HIGHLIGHT_MUTEX, VLC_ATOMIC_MUTEX, VLC_MAX_MUTEX
}
 

Functions

VLC_API void vlc_mutex_init (vlc_mutex_t *)
 
VLC_API void vlc_mutex_init_recursive (vlc_mutex_t *)
 
VLC_API void vlc_mutex_destroy (vlc_mutex_t *)
 
VLC_API void vlc_mutex_lock (vlc_mutex_t *)
 
VLC_API int vlc_mutex_trylock (vlc_mutex_t *) VLC_USED
 
VLC_API void vlc_mutex_unlock (vlc_mutex_t *)
 
VLC_API void vlc_cond_init (vlc_cond_t *)
 
VLC_API void vlc_cond_init_daytime (vlc_cond_t *)
 
VLC_API void vlc_cond_destroy (vlc_cond_t *)
 
VLC_API void vlc_cond_signal (vlc_cond_t *)
 
VLC_API void vlc_cond_broadcast (vlc_cond_t *)
 
VLC_API void vlc_cond_wait (vlc_cond_t *, vlc_mutex_t *)
 
VLC_API int vlc_cond_timedwait (vlc_cond_t *, vlc_mutex_t *, mtime_t)
 
VLC_API void vlc_sem_init (vlc_sem_t *, unsigned)
 
VLC_API void vlc_sem_destroy (vlc_sem_t *)
 
VLC_API int vlc_sem_post (vlc_sem_t *)
 
VLC_API void vlc_sem_wait (vlc_sem_t *)
 
VLC_API void vlc_rwlock_init (vlc_rwlock_t *)
 
VLC_API void vlc_rwlock_destroy (vlc_rwlock_t *)
 
VLC_API void vlc_rwlock_rdlock (vlc_rwlock_t *)
 
VLC_API void vlc_rwlock_wrlock (vlc_rwlock_t *)
 
VLC_API void vlc_rwlock_unlock (vlc_rwlock_t *)
 
VLC_API int vlc_threadvar_create (vlc_threadvar_t *, void(*)(void *))
 
VLC_API void vlc_threadvar_delete (vlc_threadvar_t *)
 
VLC_API int vlc_threadvar_set (vlc_threadvar_t, void *)
 
VLC_API void * vlc_threadvar_get (vlc_threadvar_t)
 
VLC_API int vlc_clone (vlc_thread_t *, void *(*)(void *), void *, int) VLC_USED
 
VLC_API void vlc_cancel (vlc_thread_t)
 
VLC_API void vlc_join (vlc_thread_t, void **)
 
VLC_API void vlc_control_cancel (int cmd,...)
 
VLC_API mtime_t mdate (void)
 
VLC_API void mwait (mtime_t deadline)
 
VLC_API void msleep (mtime_t delay)
 
VLC_API int vlc_timer_create (vlc_timer_t *, void(*)(void *), void *) VLC_USED
 
VLC_API void vlc_timer_destroy (vlc_timer_t)
 
VLC_API void vlc_timer_schedule (vlc_timer_t, bool, mtime_t, mtime_t)
 
VLC_API unsigned vlc_timer_getoverrun (vlc_timer_t) VLC_USED
 
VLC_API unsigned vlc_GetCPUCount (void)
 
VLC_API int vlc_savecancel (void)
 
VLC_API void vlc_restorecancel (int state)
 
VLC_API void vlc_testcancel (void)
 
VLC_API void vlc_global_mutex (unsigned, bool)
 

Detailed Description

This file defines structures and functions for handling threads in vlc

Macro Definition Documentation

#define vlc_cleanup_pop ( )    pthread_cleanup_pop (0)

Removes a cleanup procedure that was previously registered with vlc_cleanup_push().

#define vlc_cleanup_push (   routine,
  arg 
)    pthread_cleanup_push (routine, arg)

Registers a new procedure to run if the thread is cancelled (or otherwise exits prematurely). Any call to vlc_cleanup_push() must paired with a call to either vlc_cleanup_pop() or vlc_cleanup_run(). Branching into or out of the block between these two function calls is not allowed (read: it will likely crash the whole process). If multiple procedures are registered, they are handled in last-in first-out order.

Parameters
routineprocedure to call if the thread ends
argargument for the procedure
#define vlc_cleanup_run ( )    pthread_cleanup_pop (1)

Removes a cleanup procedure that was previously registered with vlc_cleanup_push(), and executes it.