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

Data Structures

struct  vlc_thread
 
struct  vlc_threadvar
 

Macros

#define IS_INTERRUPTIBLE   (!VLC_WINSTORE_APP || _WIN32_WINNT >= 0x0A00)
 
#define ABOVE_NORMAL_PRIORITY_CLASS   0x00008000
 
#define LOOKUP(s)   (((s##_) = (void *)GetProcAddress(h, #s)) != NULL)
 

Functions

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_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...
 
int vlc_threadvar_create (vlc_threadvar_t *p_tls, 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...
 
static void vlc_threadvars_cleanup (void)
 
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...
 
static void vlc_thread_destroy (vlc_thread_t th)
 
static unsigned __stdcall vlc_entry (void *p)
 
static int vlc_clone_attr (vlc_thread_t *p_handle, bool detached, void *(*entry)(void *), void *data, int priority)
 
int vlc_clone (vlc_thread_t *p_handle, void *(*entry)(void *), void *data, int priority)
 Creates and starts a new thread. More...
 
void vlc_join (vlc_thread_t th, void **result)
 Waits for a thread to complete (if needed), then destroys it. More...
 
int vlc_clone_detach (vlc_thread_t *p_handle, void *(*entry)(void *), void *data, int priority)
 
vlc_thread_t vlc_thread_self (void)
 Thread handle. More...
 
unsigned long vlc_thread_id (void)
 Thread identifier. More...
 
int vlc_set_priority (vlc_thread_t th, int priority)
 
static void CALLBACK vlc_cancel_self (ULONG_PTR self)
 
void vlc_cancel (vlc_thread_t th)
 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...
 
static mtime_t mdate_interrupt (void)
 
static mtime_t mdate_tick (void)
 
static mtime_t mdate_multimedia (void)
 
static mtime_t mdate_perf (void)
 
static mtime_t mdate_wall (void)
 
static mtime_t mdate_default (void)
 
mtime_t mdate (void)
 Precision monotonic clock. More...
 
static BOOL SelectClockSource (void *data)
 
size_t EnumClockSource (vlc_object_t *obj, const char *var, char ***vp, char ***np)
 
unsigned vlc_GetCPUCount (void)
 Count CPUs. More...
 
void vlc_threads_setup (libvlc_int_t *vlc)
 
BOOL WINAPI DllMain (HINSTANCE, DWORD, LPVOID)
 

Variables

static CRITICAL_SECTION super_mutex
 
static CONDITION_VARIABLE super_variable
 
static DWORD thread_key
 
struct vlc_threadvarvlc_threadvar_last = NULL
 
union {
   struct {
      LARGE_INTEGER   freq
 
   }   perf
 
   struct {
      UINT   cbtc
 
   }   multimedia
 
clk
 
static mtime_t(* mdate_selected )(void) = mdate_default
 
static CRITICAL_SECTION setup_lock
 
vlc_rwlock_t config_lock
 

Macro Definition Documentation

◆ ABOVE_NORMAL_PRIORITY_CLASS

#define ABOVE_NORMAL_PRIORITY_CLASS   0x00008000

◆ IS_INTERRUPTIBLE

#define IS_INTERRUPTIBLE   (!VLC_WINSTORE_APP || _WIN32_WINNT >= 0x0A00)

◆ LOOKUP

#define LOOKUP (   s)    (((s##_) = (void *)GetProcAddress(h, #s)) != NULL)

Function Documentation

◆ DllMain()

BOOL WINAPI DllMain ( HINSTANCE  hinstDll,
DWORD  fdwReason,
LPVOID  lpvReserved 
)

◆ EnumClockSource()

size_t EnumClockSource ( vlc_object_t obj,
const char *  var,
char ***  vp,
char ***  np 
)

References _, xmalloc(), and xstrdup().

◆ mdate_default()

static mtime_t mdate_default ( void  )
static

References mdate_perf(), and vlc_threads_setup().

Referenced by vlc_threads_setup().

◆ mdate_interrupt()

static mtime_t mdate_interrupt ( void  )
static

References clk, CLOCK_FREQ, static_assert, and unlikely.

Referenced by SelectClockSource().

◆ mdate_multimedia()

static mtime_t mdate_multimedia ( void  )
static

References clk, CLOCK_FREQ, and static_assert.

Referenced by SelectClockSource().

◆ mdate_perf()

static mtime_t mdate_perf ( void  )
static

References clk, lldiv(), lldiv_t::quot, and lldiv_t::rem.

Referenced by mdate_default(), and SelectClockSource().

◆ mdate_tick()

static mtime_t mdate_tick ( void  )
static

References clk, CLOCK_FREQ, and static_assert.

Referenced by SelectClockSource().

◆ mdate_wall()

static mtime_t mdate_wall ( void  )
static

References CLOCK_FREQ, and static_assert.

Referenced by SelectClockSource().

◆ SelectClockSource()

static BOOL SelectClockSource ( void *  data)
static

◆ vlc_cancel_self()

static void CALLBACK vlc_cancel_self ( ULONG_PTR  self)
static

Referenced by vlc_cancel().

◆ vlc_clone_attr()

static int vlc_clone_attr ( vlc_thread_t p_handle,
bool  detached,
void *(*)(void *)  entry,
void *  data,
int  priority 
)
static

◆ vlc_clone_detach()

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

◆ vlc_entry()

static unsigned __stdcall vlc_entry ( void *  p)
static

◆ vlc_set_priority()

int vlc_set_priority ( vlc_thread_t  th,
int  priority 
)

< Unspecified error

< No error

References VLC_EGENERIC, and VLC_SUCCESS.

◆ vlc_thread_destroy()

static void vlc_thread_destroy ( vlc_thread_t  th)
static

Referenced by vlc_entry(), vlc_join(), and vlc_testcancel().

◆ vlc_threads_setup()

void vlc_threads_setup ( libvlc_int_t vlc)

◆ vlc_threadvars_cleanup()

static void vlc_threadvars_cleanup ( void  )
static

Variable Documentation

◆ cbtc

UINT cbtc

◆ clk

union { ... } clk

◆ config_lock

vlc_rwlock_t config_lock

◆ freq

LARGE_INTEGER freq

Referenced by mdate().

◆ mdate_selected

mtime_t(* mdate_selected) (void) = mdate_default
static

◆ multimedia

struct { ... } multimedia

◆ perf

struct { ... } perf

Referenced by SelectClockSource().

◆ setup_lock

CRITICAL_SECTION setup_lock
static

Referenced by DllMain(), and vlc_threads_setup().

◆ super_mutex

CRITICAL_SECTION super_mutex
static

◆ super_variable

CONDITION_VARIABLE super_variable
static

◆ thread_key

DWORD thread_key
static

Referenced by DllMain(), vlc_entry(), and vlc_thread_self().

◆ vlc_threadvar_last

struct vlc_threadvar * vlc_threadvar_last = NULL