VLC  3.0.15
Data Structures | Macros | Functions | Variables
thread.c File Reference
Include dependency graph for thread.c:

Data Structures

struct  vlc_thread
 

Macros

#define VLC_THREAD_ASSERT(action)
 

Functions

static void vlc_thread_fatal_print (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...
 
vlc_thread_t vlc_thread_self (void)
 Thread handle. More...
 
void vlc_threads_setup (libvlc_int_t *p_libvlc)
 
static void clean_detached_thread (void *data)
 
static void * detached_thread (void *data)
 
static void finish_joinable_thread (void *data)
 
static void * joinable_thread (void *data)
 
static int vlc_clone_attr (vlc_thread_t *th, void *(*entry)(void *), void *data, bool detach)
 
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)
 
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...
 
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...
 
mtime_t mdate (void)
 Precision monotonic clock. More...
 
unsigned vlc_GetCPUCount (void)
 Count CPUs. More...
 

Variables

static thread_local struct vlc_threadthread = NULL
 

Macro Definition Documentation

◆ VLC_THREAD_ASSERT

#define VLC_THREAD_ASSERT (   action)
Value:
do { \
if (unlikely(val)) { \
vlc_thread_fatal_print (action, val, __func__, __FILE__, __LINE__); \
assert (!action); \
} \
} while(0)

Function Documentation

◆ clean_detached_thread()

static void clean_detached_thread ( void *  data)
static

◆ detached_thread()

static void* detached_thread ( void *  data)
static

◆ finish_joinable_thread()

static void finish_joinable_thread ( void *  data)
static

References vlc_thread::data, and vlc_sem_post().

Referenced by joinable_thread().

◆ joinable_thread()

static void* joinable_thread ( void *  data)
static

◆ vlc_assert_locked()

void vlc_assert_locked ( vlc_mutex_t p_mutex)

◆ vlc_clone_attr()

static int vlc_clone_attr ( vlc_thread_t th,
void *(*)(void *)  entry,
void *  data,
bool  detach 
)
static

◆ vlc_clone_detach()

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

◆ vlc_set_priority()

int vlc_set_priority ( vlc_thread_t  th,
int  priority 
)

< No error

Referenced by Run().

◆ vlc_thread_fatal_print()

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

References vlc_thread_id().

◆ vlc_threads_setup()

void vlc_threads_setup ( libvlc_int_t p_libvlc)

Variable Documentation

◆ thread

thread_local struct vlc_thread* thread = NULL
static
unlikely
#define unlikely(p)
Definition: vlc_common.h:114