VLC  3.0.21
Files | Data Structures | Macros | Typedefs | Enumerations | Functions
Threads and synchronization primitives
Collaboration diagram for Threads and synchronization primitives:

Files

file  vlc_threads.h
 

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, 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...
 
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, vlc_tick_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...
 
vlc_tick_t mdate (void)
 Precision monotonic clock. More...
 
void mwait (vlc_tick_t deadline)
 Waits until a deadline. More...
 
void msleep (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...
 
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

Macro Definition Documentation

◆ check_deadline

#define check_deadline (   d)    (d)

◆ check_delay

#define check_delay (   d)    (d)

◆ LIBVLC_USE_PTHREAD

#define LIBVLC_USE_PTHREAD   1

Whether LibVLC threads are based on POSIX threads.

◆ LIBVLC_USE_PTHREAD_CLEANUP

#define LIBVLC_USE_PTHREAD_CLEANUP   1

Whether LibVLC thread cancellation is based on POSIX threads.

◆ msleep

#define msleep (   d)    msleep(check_delay(d))

◆ mutex_cleanup_push

#define mutex_cleanup_push (   lock)    vlc_cleanup_push (vlc_cleanup_lock, lock)

◆ mwait

#define mwait (   d)    mwait(check_deadline(d))

◆ vlc_cleanup_pop

#define vlc_cleanup_pop ( )    pthread_cleanup_pop (0)

Unregisters the last cancellation handler.

This pops the cancellation handler that was last pushed with vlc_cleanup_push() in the calling thread.

◆ vlc_cleanup_push

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

Registers a thread cancellation handler.

This pushes a function to run if the thread is cancelled (or otherwise exits prematurely).

If multiple procedures are registered, they are handled in last-in first-out order.

Note
Any call to vlc_cleanup_push() must paired with a call to vlc_cleanup_pop().
Warning
Branching into or out of the block between these two function calls is not allowed (read: it will likely crash the whole process).
Parameters
routineprocedure to call if the thread ends
argargument for the procedure

◆ vlc_global_lock

#define vlc_global_lock (   n)    vlc_global_mutex(n, true)

Acquires a global mutex.

◆ vlc_global_unlock

#define vlc_global_unlock (   n)    vlc_global_mutex(n, false)

Releases a global mutex.

◆ VLC_HARD_MIN_SLEEP

#define VLC_HARD_MIN_SLEEP   10000 /* 10 milliseconds = 1 tick at 100Hz */

◆ VLC_SOFT_MIN_SLEEP

#define VLC_SOFT_MIN_SLEEP   9000000 /* 9 seconds */

◆ VLC_STATIC_COND

#define VLC_STATIC_COND   PTHREAD_COND_INITIALIZER

Static initializer for (static) condition variable.

Note
The condition variable will use the default clock, which is OS-dependent. Therefore, where timed waits are necessary the condition variable should always be initialized dynamically explicit instead of using this initializer.

◆ VLC_STATIC_MUTEX

#define VLC_STATIC_MUTEX   PTHREAD_MUTEX_INITIALIZER

Static initializer for (static) mutex.

◆ VLC_STATIC_RWLOCK

#define VLC_STATIC_RWLOCK   PTHREAD_RWLOCK_INITIALIZER

Static initializer for (static) read/write lock.

◆ VLC_THREAD_CANCELED

#define VLC_THREAD_CANCELED   PTHREAD_CANCELED

Return value of a canceled thread.

◆ VLC_THREAD_PRIORITY_AUDIO

#define VLC_THREAD_PRIORITY_AUDIO   5

◆ VLC_THREAD_PRIORITY_HIGHEST

#define VLC_THREAD_PRIORITY_HIGHEST   20

◆ VLC_THREAD_PRIORITY_INPUT

#define VLC_THREAD_PRIORITY_INPUT   10

◆ VLC_THREAD_PRIORITY_LOW

#define VLC_THREAD_PRIORITY_LOW   0

◆ VLC_THREAD_PRIORITY_OUTPUT

#define VLC_THREAD_PRIORITY_OUTPUT   15

◆ VLC_THREAD_PRIORITY_VIDEO

#define VLC_THREAD_PRIORITY_VIDEO   0

Typedef Documentation

◆ vlc_cond_t

typedef pthread_cond_t vlc_cond_t

Condition variable.

Storage space for a thread condition variable.

◆ vlc_mutex_t

typedef pthread_mutex_t vlc_mutex_t

Mutex.

Storage space for a mutual exclusion lock.

◆ vlc_rwlock_t

typedef pthread_rwlock_t vlc_rwlock_t

Read/write lock.

Storage space for a slim reader/writer lock.

◆ vlc_sem_t

typedef sem_t vlc_sem_t

Semaphore.

Storage space for a thread-safe semaphore.

◆ vlc_threadvar_t

typedef pthread_key_t vlc_threadvar_t

Thread-local key handle.

◆ vlc_timer_t

typedef struct vlc_timer* vlc_timer_t

Threaded timer handle.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
VLC_CLEANUP_PUSH 
VLC_CLEANUP_POP 
VLC_CANCEL_ADDR_SET 
VLC_CANCEL_ADDR_CLEAR 

◆ anonymous enum

anonymous enum
Enumerator
VLC_AVCODEC_MUTEX 
VLC_GCRYPT_MUTEX 
VLC_XLIB_MUTEX 
VLC_MOSAIC_MUTEX 
VLC_HIGHLIGHT_MUTEX 
VLC_MAX_MUTEX 

Function Documentation

◆ mdate()

vlc_tick_t mdate ( void  )

Precision monotonic clock.

In principles, the clock has a precision of 1 MHz. But the actual resolution may be much lower, especially when it comes to sleeping with mwait() or msleep(). Most general-purpose operating systems provide a resolution of only 100 to 1000 Hz.

Warning
The origin date (time value "zero") is not specified. It is typically the time the kernel started, but this is platform-dependent. If you need wall clock time, use gettimeofday() instead.
Returns
a timestamp in microseconds.

References freq, gettimeofday(), lldiv(), mdate_selected, Q2LL, lldiv_t::quot, lldiv_t::rem, timespec::tv_nsec, timespec::tv_sec, unlikely, vlc_clock_conversion_factor, and vlc_clock_setup.

Referenced by aout_DecPlay(), aout_DecSynchronize(), CmdExecuteDel(), CmdExecuteSend(), DecoderTimedWait(), EsOutControlLocked(), ImageRead(), MainLoop(), msleep(), mwait(), net_Connect(), RunThread(), sout_AnnounceRegisterSDP(), stats_Update(), Thread(), ThreadDisplayPreparePicture(), vlc_cond_timedwait(), vlc_msleep_i11e(), vlc_timer_schedule(), vlc_tls_ClientSessionCreate(), vout_chrono_Stop(), vout_InitInterlacingSupport(), vout_OSDEpg(), vout_OSDText(), vout_SetInterlacingState(), vout_snapshot_Get(), and VoutSnapshotPip().

◆ msleep()

void msleep ( vlc_tick_t  delay)

Waits for an interval of time.

Parameters
delayhow long to wait (in microseconds)
Note
The delay may be exceeded due to OS scheduling.
This function is a cancellation point.

References mdate(), mtime_to_ts(), mwait(), and vlc_clock_setup.

Referenced by mwait().

◆ mwait()

void mwait ( vlc_tick_t  deadline)

Waits until a deadline.

Parameters
deadlinetimestamp to wait for (mdate())
Note
The deadline may be exceeded due to OS scheduling.
This function is a cancellation point.

References mdate(), msleep(), mtime_to_ts(), unlikely, vlc_clock_setup, vlc_Sleep(), and vlc_testcancel().

Referenced by msleep().

◆ vlc_addr_broadcast()

void vlc_addr_broadcast ( void *  addr)

Wakes up all thread on an address.

Wakes up all threads sleeping on the specified address (if any). Any thread sleeping within a call to vlc_addr_wait() or vlc_addr_timedwait() with the specified address as first call parameter will be woken up.

Parameters
addraddress identifying which threads to wake up

References vlc_futex_wake().

Referenced by vlc_cancel().

◆ vlc_addr_signal()

void vlc_addr_signal ( void *  addr)

Wakes up one thread on an address.

Wakes up (at least) one of the thread sleeping on the specified address. The address must be equal to the first parameter given by at least one thread sleeping within the vlc_addr_wait() or vlc_addr_timedwait() functions. If no threads are found, this function does nothing.

Parameters
addraddress identifying which threads may be woken up

References vlc_futex_wake().

◆ vlc_addr_timedwait()

bool vlc_addr_timedwait ( void *  addr,
unsigned  val,
vlc_tick_t  delay 
)

Waits on an address with a time-out.

This function operates as vlc_addr_wait() but provides an additional time-out. If the time-out elapses, the thread resumes and the function returns.

Parameters
addraddress to check for
valvalue to match at the address
delaytime-out duration
Returns
true if the function was woken up before the time-out, false if the time-out elapsed.

References CLOCK_FREQ, lldiv(), lldiv_t::quot, lldiv_t::rem, and vlc_futex_wait().

◆ vlc_addr_wait()

void vlc_addr_wait ( void *  addr,
unsigned  val 
)

Waits on an address.

Puts the calling thread to sleep if a specific value is stored at a specified address. The thread will sleep until it is woken up by a call to vlc_addr_signal() or vlc_addr_broadcast() in another thread, or spuriously.

If the value does not match, do nothing and return immediately.

Parameters
addraddress to check for
valvalue to match at the address

References vlc_futex_wait().

◆ vlc_cancel()

void vlc_cancel ( vlc_thread_t  )

Marks a thread as cancelled.

Next time the target thread reaches a cancellation point (while not having disabled cancellation), it will run its cancellation cleanup handler, the thread variable destructors, and terminate.

vlc_join() must be used regardless of a thread being cancelled or not, to avoid leaking resources.

References vlc_thread::addr, vlc_thread_t::handle, vlc_addr_broadcast(), vlc_cancel_self(), vlc_mutex_lock(), and vlc_mutex_unlock().

Referenced by AddressDestroy(), input_DecoderDelete(), vlc_h2_conn_destroy(), vlc_h2_output_destroy(), vlc_timer_destroy(), and vlm_Delete().

◆ vlc_cancel_addr_clear()

static void vlc_cancel_addr_clear ( void *  addr)
inlinestatic

◆ vlc_cancel_addr_set()

static void vlc_cancel_addr_set ( void *  addr)
inlinestatic

◆ vlc_cleanup_lock()

static void vlc_cleanup_lock ( void *  lock)
inlinestatic

References lock, and vlc_mutex_unlock().

◆ vlc_clone()

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

Creates and starts a new thread.

The thread must be joined with vlc_join() to reclaim resources when it is not needed anymore.

Parameters
thstorage space for the handle of the new thread (cannot be NULL) [OUT]
entryentry point for the thread
datadata parameter given to the entry point
prioritythread priority value
Returns
0 on success, a standard error code on error.
Note
In case of error, the value of *th is undefined.

References vlc_thread::data, and vlc_clone_attr().

Referenced by addons_manager_Gather(), AddressCreate(), decoder_New(), input_Start(), playlist_Activate(), StartWorker(), update_Check(), update_Download(), vlc_demux_chained_New(), vlc_h2_conn_create(), vlc_h2_output_create(), vlc_mta_acquire(), vlc_timer_create(), and vlm_New().

◆ vlc_cond_broadcast()

void vlc_cond_broadcast ( vlc_cond_t )

Wakes up all threads waiting on a condition variable.

Note
This function is not a cancellation point.

References vlc_cond_signal(), and vlc_static_cond_init().

Referenced by picture_pool_Cancel(), Thread(), vlc_h2_stream_end(), vlc_h2_stream_reset(), vlc_mutex_unlock(), vout_control_Dead(), vout_control_Pop(), and vout_snapshot_End().

◆ vlc_cond_destroy()

void vlc_cond_destroy ( vlc_cond_t )

◆ vlc_cond_init()

void vlc_cond_init ( vlc_cond_t )

◆ vlc_cond_init_daytime()

void vlc_cond_init_daytime ( vlc_cond_t )

Initializes a condition variable (wall clock).

This function initializes a condition variable for timed waiting using the UTC wall clock time. The time reference is the same as with time() and with timespec_get() and TIME_UTC. vlc_cond_timedwait_daytime() must be instead of vlc_cond_timedwait() for actual waiting.

References unlikely, and vlc_cond_init().

Referenced by vlm_New().

◆ vlc_cond_signal()

void vlc_cond_signal ( vlc_cond_t )

◆ vlc_cond_timedwait()

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.

This works like vlc_cond_wait() but with an additional time-out. The time-out is expressed as an absolute timestamp using the same arbitrary time reference as the mdate() and mwait() functions.

Note
This function is a cancellation point. In case of thread cancellation, the mutex is always locked before cancellation proceeds.
Parameters
condcondition variable to wait on
mutexmutex which is unlocked while waiting, then locked again when waking up
deadlineabsolute timeout
Warning
If the variable was initialized with vlc_cond_init_daytime(), or was statically initialized with VLC_STATIC_COND, the time reference used by this function is unspecified (depending on the implementation, it might be the Unix epoch or the mdate() clock).
Returns
0 if the condition was signaled, an error code in case of timeout.

References mdate(), mtime_to_ts(), vlc_cond_wait_common(), and VLC_THREAD_ASSERT.

Referenced by RunThread(), Thread(), vlc_fifo_TimedWaitCond(), vlc_mwait_i11e(), vout_control_Pop(), and vout_snapshot_Get().

◆ vlc_cond_timedwait_daytime()

int vlc_cond_timedwait_daytime ( vlc_cond_t ,
vlc_mutex_t ,
time_t   
)

◆ vlc_cond_wait()

void vlc_cond_wait ( vlc_cond_t cond,
vlc_mutex_t mutex 
)

Waits on a condition variable.

The calling thread will be suspended until another thread calls vlc_cond_signal() or vlc_cond_broadcast() on the same condition variable, the thread is cancelled with vlc_cancel(), or the system causes a spurious unsolicited wake-up.

A mutex is needed to wait on a condition variable. It must not be a recursive mutex. Although it is possible to use the same mutex for multiple condition, it is not valid to use different mutexes for the same condition variable at the same time from different threads.

The canonical way to use a condition variable to wait for event foobar is:

mutex_cleanup_push(&lock); // release the mutex in case of cancellation
while (!foobar)
vlc_cond_wait(&wait, &lock);
// -- foobar is now true, do something about it here --
Note
This function is a cancellation point. In case of thread cancellation, the mutex is always locked before cancellation proceeds.
Parameters
condcondition variable to wait on
mutexmutex which is unlocked while waiting, then locked again when waking up.

References vlc_cond_wait_common(), vlc_static_cond_init(), and VLC_THREAD_ASSERT.

Referenced by BackgroundWorkerCancel(), dialog_wait(), picture_pool_Wait(), RunThread(), Thread(), vlc_fifo_WaitCond(), vlc_h2_output_dequeue(), vlc_h2_stream_read(), vlc_h2_stream_wait(), vlc_mutex_lock(), vout_control_WaitEmpty(), and WaitUnused().

◆ vlc_control_cancel()

void vlc_control_cancel ( int  cmd,
  ... 
)

◆ vlc_GetCPUCount()

unsigned vlc_GetCPUCount ( void  )

Count CPUs.

Returns
number of available (logical) CPUs.

References count, unlikely, and vlc_alloc().

◆ vlc_global_mutex()

void vlc_global_mutex ( unsigned  ,
bool   
)

Internal handler for global mutexes.

Do not use this function directly. Use helper macros instead: vlc_global_lock(), vlc_global_unlock().

References lock, static_assert, VLC_MAX_MUTEX, vlc_mutex_lock(), vlc_mutex_unlock(), and VLC_STATIC_MUTEX.

◆ vlc_join()

void vlc_join ( vlc_thread_t  th,
void **  result 
)

Waits for a thread to complete (if needed), then destroys it.

Note
This is a cancellation point. In case of cancellation, the thread is not joined.
Warning
A thread cannot join itself (normally VLC will abort if this is attempted). Also a detached thread cannot be joined.
Parameters
ththread handle
result[OUT] pointer to write the thread return value or NULL

References clean_detached_thread(), vlc_thread_t::handle, vlc_sem_destroy(), vlc_sem_wait(), vlc_testcancel(), VLC_THREAD_ASSERT, vlc_thread_destroy(), and vlc_WaitForSingleObject().

Referenced by AddressDestroy(), CloseWorker(), input_Close(), input_DecoderDelete(), playlist_Deactivate(), update_Check(), update_Delete(), update_Download(), vlc_demux_chained_Delete(), vlc_h2_conn_destroy(), vlc_h2_output_destroy(), vlc_mta_release(), vlc_timer_destroy(), and vlm_Delete().

◆ vlc_mutex_destroy()

void vlc_mutex_destroy ( vlc_mutex_t )

◆ vlc_mutex_init()

void vlc_mutex_init ( vlc_mutex_t )

◆ vlc_mutex_init_recursive()

void vlc_mutex_init_recursive ( vlc_mutex_t )

Initializes a recursive mutex.

Warning
This is strongly discouraged. Please use normal mutexes.

References unlikely.

Referenced by input_EsOutNew(), input_EsOutTimeshiftNew(), and vlc_event_manager_init().

◆ vlc_mutex_lock()

void vlc_mutex_lock ( vlc_mutex_t )

Acquires a mutex.

If needed, this waits for any other thread to release it.

Warning
Beware of deadlocks when locking multiple mutexes at the same time, or when using mutexes from callbacks.
Note
This function is not a cancellation point.

References super_mutex, super_variable, vlc_cond_wait(), vlc_mutex_lock(), vlc_mutex_unlock(), vlc_restorecancel(), vlc_savecancel(), and VLC_THREAD_ASSERT.

Referenced by AddAlbumCache(), addons_manager_Gather(), aout_ChangeViewpoint(), aout_DecPlay(), aout_DeviceSet(), aout_DevicesList(), aout_HotplugNotify(), aout_MuteSet(), aout_OutputLock(), aout_OutputUnlock(), aout_update_format(), aout_VolumeSet(), ArtCachePath(), AStreamReadBlock(), AStreamReadStream(), background_worker_Push(), background_worker_RequestProbe(), BackgroundWorkerCancel(), block_FifoCount(), block_FifoShow(), block_FifoSize(), CheckArt(), CheckMeta(), config_GetLibDir(), config_SaveConfigFile(), Create(), CreateCacheKey(), DecoderGetDisplayDate(), DecoderPlayCc(), DecoderProcess(), DecoderThread(), dialog_cancel_locked(), dialog_display_error_va(), dialog_display_login_va(), dialog_display_question_va(), dialog_id_post(), dialog_remove_locked(), dialog_update_progress(), dialog_wait(), dialog_wait_interrupted(), display_progress_va(), EsOutSend(), getHeldEntryByUUID(), input_clock_GetState(), input_clock_Update(), input_DecoderDelete(), input_ExtractAttachmentAndCacheArt(), input_item_AddInfo(), input_item_AddOpaque(), input_item_AddOption(), input_item_AddSlave(), input_item_ApplyOptions(), input_item_ChangeEPGSource(), input_item_Copy(), input_item_CopyOptions(), input_item_DelInfo(), input_item_GetDuration(), input_item_GetInfo(), input_item_GetMeta(), input_item_GetName(), input_item_GetTitleFbName(), input_item_GetURI(), input_item_HasErrorWhenReading(), input_item_IsArtFetched(), input_item_IsPreparsed(), input_item_MergeInfos(), input_item_MetaMatch(), input_item_node_AppendItem(), input_item_SetArtFetched(), input_item_SetArtNotFound(), input_item_SetDuration(), input_item_SetEpg(), input_item_SetEpgEvent(), input_item_SetEpgOffline(), input_item_SetEpgTime(), input_item_SetErrorWhenReading(), input_item_SetMeta(), input_item_SetPreparsed(), input_item_SetURI(), input_item_ShouldPreparseSubItems(), input_item_UpdateTracksInfo(), input_item_WriteMeta(), input_resource_GetAout(), input_resource_RequestSout(), input_Stop(), input_vaControl(), InputEvent(), intf_Create(), intf_DestroyAll(), intf_GetPlaylist(), libvlc_InternalDialogClean(), libvlc_InternalPlay(), libvlc_MetadataRequest(), libvlc_Quit(), libvlc_SetExitHandler(), MainLoopStatistics(), module_EndBank(), module_InitBank(), picture_pool_Cancel(), picture_pool_Get(), picture_pool_ReleasePicture(), picture_pool_Wait(), playlist_LiveSearchUpdateInternal(), playlist_Lock(), playlist_preparser_Push(), ReadAlbumCache(), ReloadDecoder(), RunThread(), sout_AnnounceRegisterSDP(), sout_AnnounceUnRegister(), spu_ClearChannel(), stats_ComputeInputStats(), stats_ReinitInputStats(), Thread(), ThreadDisplayPreparePicture(), UpdateBookmarksOption(), UpdateSPU(), var_Create(), vlc_cancel(), vlc_cond_wait_common(), vlc_control_cancel(), vlc_custom_create(), vlc_demux_chained_ControlVa(), vlc_dialog_id_get_context(), vlc_dialog_id_set_context(), vlc_dialog_is_cancelled(), vlc_dialog_provider_set_callbacks(), vlc_dialog_provider_set_ext_callback(), vlc_dialog_release(), vlc_drand48(), vlc_event_attach(), vlc_event_detach(), vlc_ext_dialog_update(), vlc_fifo_Lock(), vlc_gl_surface_CheckSize(), vlc_gl_surface_ResizeNotify(), vlc_global_mutex(), vlc_h2_client_output_thread(), vlc_h2_conn_release(), vlc_h2_output_dequeue(), vlc_h2_output_destroy(), vlc_h2_output_queue(), vlc_h2_output_thread(), vlc_h2_recv_thread(), vlc_h2_stream_close(), vlc_h2_stream_lock(), vlc_h2_stream_open(), vlc_h2_stream_wake_up(), vlc_http_cookies_fetch(), vlc_http_cookies_store(), vlc_interrupt_finish(), vlc_interrupt_prepare(), vlc_interrupt_raise(), vlc_list_children(), vlc_lrand48(), vlc_mrand48(), vlc_mutex_lock(), vlc_mutex_trylock(), vlc_mutex_unlock(), vlc_mwait_i11e(), vlc_object_find_name(), vlc_object_get_name(), vlc_object_release(), vlc_object_set_name(), vlc_static_cond_init(), vlc_thread_cleanup(), vlc_threads_setup(), vlc_threadvar_create(), vlc_threadvar_delete(), vlc_timer_schedule(), vlc_timer_thread(), vlm_Delete(), vlm_ExecuteCommand(), vlm_New(), vout_control_Dead(), vout_control_Pop(), vout_control_Push(), vout_control_WaitEmpty(), vout_control_Wake(), vout_display_window_Attach(), vout_display_window_Detach(), vout_OSDEpg(), vout_SendDisplayEventMouse(), vout_snapshot_End(), vout_snapshot_Get(), and vout_update_format().

◆ vlc_mutex_trylock()

int vlc_mutex_trylock ( vlc_mutex_t )

Tries to acquire a mutex.

This function acquires the mutex if and only if it is not currently held by another thread. This function never sleeps and can be used in delay-critical code paths.

Note
This function is not a cancellation point.
Warning
If this function fails, then the mutex is held... by another thread. The calling thread must deal with the error appropriately. That typically implies postponing the operations that would have required the mutex. If the thread cannot defer those operations, then it must use vlc_mutex_lock(). If in doubt, use vlc_mutex_lock() instead.
Returns
0 if the mutex could be acquired, an error code otherwise.

References super_mutex, vlc_mutex_lock(), vlc_mutex_unlock(), and VLC_THREAD_ASSERT.

Referenced by aout_OutputTryLock(), and vout_snapshot_IsRequested().

◆ vlc_mutex_unlock()

void vlc_mutex_unlock ( vlc_mutex_t )

Releases a mutex.

If the mutex is not held by the calling thread, the behaviour is undefined.

Note
This function is not a cancellation point.

References super_mutex, super_variable, vlc_cond_broadcast(), vlc_mutex_lock(), vlc_mutex_unlock(), and VLC_THREAD_ASSERT.

Referenced by AddAlbumCache(), addons_manager_Gather(), aout_ChangeViewpoint(), aout_DecPlay(), aout_DeviceSet(), aout_DevicesList(), aout_HotplugNotify(), aout_MuteSet(), aout_OutputUnlock(), aout_update_format(), aout_VolumeSet(), ArtCachePath(), AStreamReadBlock(), AStreamReadStream(), background_worker_Push(), background_worker_RequestProbe(), BackgroundWorkerCancel(), block_FifoCount(), block_FifoShow(), block_FifoSize(), CheckArt(), CheckMeta(), config_GetLibDir(), config_SaveConfigFile(), Create(), CreateCacheKey(), DecoderGetDisplayDate(), DecoderPlayCc(), DecoderProcess(), DecoderThread(), dialog_cancel_locked(), dialog_display_error_va(), dialog_display_login_va(), dialog_display_question_va(), dialog_id_post(), dialog_remove_locked(), dialog_update_progress(), dialog_wait(), dialog_wait_interrupted(), display_progress_va(), EsOutSend(), getHeldEntryByUUID(), input_clock_GetState(), input_DecoderDelete(), input_ExtractAttachmentAndCacheArt(), input_item_AddInfo(), input_item_AddOpaque(), input_item_AddOption(), input_item_AddSlave(), input_item_ApplyOptions(), input_item_ChangeEPGSource(), input_item_Copy(), input_item_CopyOptions(), input_item_DelInfo(), input_item_GetDuration(), input_item_GetInfo(), input_item_GetMeta(), input_item_GetName(), input_item_GetTitleFbName(), input_item_GetURI(), input_item_HasErrorWhenReading(), input_item_IsArtFetched(), input_item_IsPreparsed(), input_item_MergeInfos(), input_item_MetaMatch(), input_item_node_AppendItem(), input_item_SetArtFetched(), input_item_SetArtNotFound(), input_item_SetDuration(), input_item_SetEpg(), input_item_SetEpgEvent(), input_item_SetEpgOffline(), input_item_SetEpgTime(), input_item_SetErrorWhenReading(), input_item_SetMeta(), input_item_SetPreparsed(), input_item_SetURI(), input_item_ShouldPreparseSubItems(), input_item_UpdateTracksInfo(), input_item_WriteMeta(), input_resource_GetAout(), input_resource_RequestSout(), input_Stop(), input_vaControl(), InputEvent(), intf_Create(), intf_DestroyAll(), intf_GetPlaylist(), libvlc_InternalDialogClean(), libvlc_InternalPlay(), libvlc_MetadataRequest(), libvlc_Quit(), libvlc_SetExitHandler(), MainLoopStatistics(), module_EndBank(), module_LoadPlugins(), picture_pool_Cancel(), picture_pool_Get(), picture_pool_ReleasePicture(), picture_pool_Wait(), playlist_LiveSearchUpdateInternal(), playlist_preparser_Push(), ReadAlbumCache(), ReloadDecoder(), sout_AnnounceRegisterSDP(), sout_AnnounceUnRegister(), spu_ClearChannel(), stats_ComputeInputStats(), stats_ReinitInputStats(), Thread(), ThreadDisplayPreparePicture(), UpdateBookmarksOption(), UpdateSPU(), var_Change(), var_Create(), var_Destroy(), var_GetAndSet(), var_GetChecked(), var_SetChecked(), var_TriggerCallback(), var_Type(), vlc_cancel(), vlc_cleanup_lock(), vlc_cond_wait_common(), vlc_control_cancel(), vlc_custom_create(), vlc_demux_chained_ControlVa(), vlc_dialog_id_get_context(), vlc_dialog_id_set_context(), vlc_dialog_is_cancelled(), vlc_dialog_provider_set_callbacks(), vlc_dialog_provider_set_ext_callback(), vlc_dialog_release(), vlc_drand48(), vlc_event_attach(), vlc_event_detach(), vlc_ext_dialog_update(), vlc_fifo_Unlock(), vlc_gl_surface_CheckSize(), vlc_gl_surface_ResizeNotify(), vlc_global_mutex(), vlc_h2_client_output_thread(), vlc_h2_conn_release(), vlc_h2_output_dequeue(), vlc_h2_output_destroy(), vlc_h2_output_queue(), vlc_h2_output_thread(), vlc_h2_recv_thread(), vlc_h2_stream_close(), vlc_h2_stream_open(), vlc_h2_stream_unlock(), vlc_h2_stream_wake_up(), vlc_http_cookies_fetch(), vlc_http_cookies_store(), vlc_interrupt_finish(), vlc_interrupt_prepare(), vlc_interrupt_raise(), vlc_list_children(), vlc_lrand48(), vlc_mrand48(), vlc_mutex_lock(), vlc_mutex_trylock(), vlc_mutex_unlock(), vlc_mwait_i11e(), vlc_mwait_i11e_cleanup(), vlc_object_find_name(), vlc_object_get_name(), vlc_object_release(), vlc_object_set_name(), vlc_static_cond_init(), vlc_thread_cleanup(), vlc_threads_setup(), vlc_threadvar_create(), vlc_threadvar_delete(), vlc_timer_schedule(), vlm_Delete(), vlm_ExecuteCommand(), vlm_New(), vout_control_Dead(), vout_control_Pop(), vout_control_Push(), vout_control_WaitEmpty(), vout_control_Wake(), vout_display_window_Attach(), vout_display_window_Detach(), vout_OSDEpg(), vout_SendDisplayEventMouse(), vout_snapshot_End(), vout_snapshot_Get(), vout_snapshot_IsRequested(), and vout_update_format().

◆ vlc_restorecancel()

void vlc_restorecancel ( int  state)

Restores the cancellation state.

This function restores the cancellation state of the calling thread to a state previously saved by vlc_savecancel().

Note
This function is not a cancellation point.
Parameters
stateprevious state as returned by vlc_savecancel().

References vlc_thread::killable, thread, unlikely, VLC_THREAD_ASSERT, vlc_thread_fatal(), and vlc_thread_self().

Referenced by DecoderThread(), PrintObject(), vlc_custom_create(), vlc_h2_output_dequeue(), vlc_h2_recv_thread(), vlc_https_connect_proxy(), vlc_https_recv(), vlc_https_send(), vlc_mutex_lock(), vlc_object_release(), vlc_poll_i11e_inner(), vlc_poll_i11e_wake(), vlc_thread_fatal(), vlc_tls_ClientSessionCreate(), vlc_tls_SessionCreate(), and vlc_tls_SessionDelete().

◆ vlc_rwlock_destroy()

void vlc_rwlock_destroy ( vlc_rwlock_t )

Destroys an initialized unused read/write lock.

References lock, and VLC_THREAD_ASSERT.

Referenced by _DLL_InitTerm(), and DllMain().

◆ vlc_rwlock_init()

void vlc_rwlock_init ( vlc_rwlock_t )

Initializes a read/write lock.

References lock, and unlikely.

Referenced by _DLL_InitTerm(), DllMain(), and vlc_LogPreinit().

◆ vlc_rwlock_rdlock()

void vlc_rwlock_rdlock ( vlc_rwlock_t )

Acquires a read/write lock for reading.

Note
Recursion is allowed.
This function may be a point of cancellation.

References lock, and VLC_THREAD_ASSERT.

Referenced by config_GetFloat(), config_GetInt(), config_GetPsz(), and config_SaveConfigFile().

◆ vlc_rwlock_unlock()

void vlc_rwlock_unlock ( vlc_rwlock_t )

Releases a read/write lock.

The calling thread must hold the lock. Otherwise behaviour is undefined.

Note
This function is not a cancellation point.

References lock, and VLC_THREAD_ASSERT.

Referenced by config_GetFloat(), config_GetInt(), config_GetPsz(), config_LoadConfigFile(), config_PutFloat(), config_PutInt(), config_PutPsz(), config_SaveConfigFile(), vlc_LogInit(), and vlc_LogSet().

◆ vlc_rwlock_wrlock()

void vlc_rwlock_wrlock ( vlc_rwlock_t )

Acquires a read/write lock for writing.

Recursion is not allowed.

Note
This function may be a point of cancellation.

References lock, and VLC_THREAD_ASSERT.

Referenced by config_LoadConfigFile(), config_PutFloat(), config_PutInt(), config_PutPsz(), vlc_LogInit(), and vlc_LogSet().

◆ vlc_savecancel()

int vlc_savecancel ( void  )

Disables thread cancellation.

This functions saves the current cancellation state (enabled or disabled), then disables cancellation for the calling thread. It must be called before entering a piece of code that is not cancellation-safe, unless it can be proven that the calling thread will not be cancelled.

Note
This function is not a cancellation point.
Returns
Previous cancellation state (opaque value for vlc_restorecancel()).

References vlc_thread::killable, thread, VLC_THREAD_ASSERT, and vlc_thread_self().

Referenced by DecoderThread(), PrintObject(), vlc_custom_create(), vlc_h2_output_dequeue(), vlc_h2_recv_thread(), vlc_https_connect_proxy(), vlc_https_recv(), vlc_https_send(), vlc_mutex_lock(), vlc_object_release(), vlc_poll_i11e_inner(), vlc_poll_i11e_wake(), vlc_thread_fatal(), vlc_tls_ClientSessionCreate(), vlc_tls_SessionCreate(), and vlc_tls_SessionDelete().

◆ vlc_sem_destroy()

void vlc_sem_destroy ( vlc_sem_t )

Deinitializes a semaphore.

References likely, and VLC_THREAD_ASSERT.

Referenced by vlc_getaddrinfo_i11e(), vlc_join(), vlc_mta_acquire(), and vlc_mta_release().

◆ vlc_sem_init()

void vlc_sem_init ( vlc_sem_t ,
unsigned  count 
)

Initializes a semaphore.

Parameters
countinitial semaphore value (typically 0)

References unlikely.

Referenced by vlc_clone_attr(), vlc_getaddrinfo_i11e(), and vlc_mta_acquire().

◆ vlc_sem_post()

int vlc_sem_post ( vlc_sem_t )

Increments the value of a semaphore.

Note
This function is not a cancellation point.
Returns
0 on success, EOVERFLOW in case of integer overflow.

References likely, unlikely, and VLC_THREAD_ASSERT.

Referenced by finish_joinable_thread(), InputEventPreparse(), joinable_thread(), MtaMainLoop(), vlc_gai_thread(), vlc_getaddrinfo_notify(), vlc_interrupt_sem(), and vlc_mta_release().

◆ vlc_sem_wait()

void vlc_sem_wait ( vlc_sem_t )

Waits on a semaphore.

This function atomically waits for the semaphore to become non-zero then decrements it, and returns. If the semaphore is non-zero on entry, it is immediately decremented.

Note
This function may be a point of cancellation.

References likely, and VLC_THREAD_ASSERT.

Referenced by MtaMainLoop(), vlc_getaddrinfo_i11e(), vlc_join(), vlc_mta_acquire(), and vlc_sem_wait_i11e().

◆ vlc_testcancel()

void vlc_testcancel ( void  )

Issues an explicit deferred cancellation point.

This has no effects if thread cancellation is disabled. This can be called when there is a rather slow non-sleeping operation. This is also used to force a cancellation point in a function that would otherwise not always be one (block_FifoGet() is an example).

References vlc_thread::cancel_event, vlc_thread::cleaners, vlc_thread::data, vlc_thread::done_event, vlc_thread::id, vlc_thread::killable, vlc_thread::killed, p, thread, vlc_cancel_self(), vlc_thread_cleanup(), vlc_thread_destroy(), and vlc_thread_self().

Referenced by block_FifoGet(), DecoderThread(), mwait(), net_Read(), net_Write(), vlc_cond_wait_common(), vlc_join(), vlc_poll_i11e_inner(), and vlc_select().

◆ vlc_thread_id()

unsigned long vlc_thread_id ( void  )

Thread identifier.

This function returns the identifier of the calling thread. The identifier cannot change for the entire duration of the thread, and no other thread can have the same identifier at the same time in the same process. Typically, the identifier is also unique across all running threads of all existing processes, but that depends on the operating system.

There are no particular semantics to the thread ID with LibVLC. It is provided mainly for tracing and debugging.

Warning
This function is not currently implemented on all supported platforms. Where not implemented, it returns (unsigned long)-1.
Returns
the thread identifier (or -1 if unimplemented)

References unlikely.

Referenced by vlc_thread_fatal(), vlc_thread_fatal_print(), and vlc_vaLog().

◆ vlc_thread_self()

vlc_thread_t vlc_thread_self ( void  )

Thread handle.

This function returns the thread handle of the calling thread.

Note
The exact type of the thread handle depends on the platform, including an integer type, a pointer type or a compound type of any size. If you need an integer identifier, use vlc_thread_id() instead.
vlc_join(vlc_thread_self(), NULL) is undefined, as it obviously does not make any sense (it might result in a deadlock, but there are no warranties that it will).
Returns
the thread handle

References thread, thread_key, and vlc_threadvar_get().

Referenced by vlc_control_cancel(), vlc_DosWaitEventSemEx(), vlc_restorecancel(), vlc_savecancel(), vlc_select(), and vlc_testcancel().

◆ vlc_threadvar_create()

int vlc_threadvar_create ( vlc_threadvar_t key,
void(*)(void *)  destr 
)

Allocates a thread-specific variable.

Parameters
keywhere to store the thread-specific variable handle
destra destruction callback. It is called whenever a thread exits and the thread-specific variable has a non-NULL value.
Returns
0 on success, a system error code otherwise. This function can actually fail: on most systems, there is a fixed limit to the number of thread-specific variables in a given process.

References vlc_threadvar::destroy, vlc_threadvar::id, vlc_threadvar::next, vlc_threadvar::prev, super_mutex, unlikely, vlc_mutex_lock(), vlc_mutex_unlock(), and vlc_threadvar_last.

Referenced by _DLL_InitTerm().

◆ vlc_threadvar_delete()

void vlc_threadvar_delete ( vlc_threadvar_t )

◆ vlc_threadvar_get()

void* vlc_threadvar_get ( vlc_threadvar_t  )

Gets the value of a thread-local variable for the calling thread.

This function cannot fail.

Returns
the value associated with the given variable for the calling or NULL if no value was set.

Referenced by vlc_thread_cleanup(), vlc_thread_self(), and vlc_threadvars_cleanup().

◆ vlc_threadvar_set()

int vlc_threadvar_set ( vlc_threadvar_t  key,
void *  value 
)

Sets a thread-specific variable.

Parameters
keythread-local variable key (created with vlc_threadvar_create())
valuenew value for the variable for the calling thread
Returns
0 on success, a system error code otherwise.

Referenced by vlc_entry(), vlc_thread_cleanup(), and vlc_threadvars_cleanup().

◆ vlc_timer_create()

int vlc_timer_create ( vlc_timer_t id,
void(*)(void *)  func,
void *  data 
)

Initializes an asynchronous timer.

Parameters
idpointer to timer to be initialized
funcfunction that the timer will call
dataparameter for the timer function
Returns
0 on success, a system error code otherwise.
Warning
Asynchronous timers are processed from an unspecified thread.
Note
Multiple occurrences of a single interval timer are serialized: they cannot run concurrently.

References vlc_timer::data, vlc_timer::func, vlc_timer::hev, vlc_timer::htimer, vlc_timer::interval, vlc_timer::lock, vlc_timer::overruns, vlc_timer::quit, vlc_timer::reschedule, vlc_timer::thread, vlc_timer::tid, unlikely, vlc_timer::value, vlc_clone(), vlc_cond_destroy(), vlc_cond_init(), vlc_mutex_destroy(), vlc_mutex_init(), VLC_THREAD_PRIORITY_INPUT, vlc_timer_do(), and vlc_timer_thread().

◆ vlc_timer_destroy()

void vlc_timer_destroy ( vlc_timer_t  timer)

Destroys an initialized timer.

If needed, the timer is first disarmed. Behaviour is undefined if the specified timer is not initialized.

Warning
This function must be called before the timer data can be freed and before the timer callback function can be unmapped/unloaded.
Parameters
timertimer to destroy

References vlc_timer::handle, vlc_timer::hev, vlc_timer::htimer, vlc_timer::lock, vlc_timer::quit, vlc_timer::reschedule, vlc_timer::thread, vlc_timer::tid, vlc_cancel(), vlc_cond_destroy(), vlc_join(), and vlc_mutex_destroy().

◆ vlc_timer_getoverrun()

unsigned vlc_timer_getoverrun ( vlc_timer_t  )

Fetches and resets the overrun counter for a timer.

This functions returns the number of times that the interval timer should have fired, but the callback was not invoked due to scheduling problems. The call resets the counter to zero.

Parameters
timerinitialized timer
Returns
the timer overrun counter (typically zero)

References vlc_timer::overruns.

◆ vlc_timer_schedule()

void vlc_timer_schedule ( vlc_timer_t  timer,
bool  absolute,
vlc_tick_t  value,
vlc_tick_t  interval 
)

Arms or disarms an initialized timer.

This functions overrides any previous call to itself.

Note
A timer can fire later than requested due to system scheduling limitations. An interval timer can fail to trigger sometimes, either because the system is busy or suspended, or because a previous iteration of the timer is still running. See also vlc_timer_getoverrun().
Parameters
timerinitialized timer
absolutethe timer value origin is the same as mdate() if true, the timer value is relative to now if false.
valuezero to disarm the timer, otherwise the initial time to wait before firing the timer.
intervalzero to fire the timer just once, otherwise the timer repetition interval.

References vlc_timer::handle, vlc_timer::hev, vlc_timer::htimer, vlc_timer::interval, vlc_timer::lock, mdate(), vlc_timer::reschedule, vlc_timer::value, vlc_cond_signal(), vlc_mutex_lock(), vlc_mutex_unlock(), and vlc_timer_do().

lock
static vlc_mutex_t lock
Definition: interface.c:62
vlc_cleanup_pop
#define vlc_cleanup_pop()
Unregisters the last cancellation handler.
Definition: vlc_threads.h:983
vlc_cond_wait
void vlc_cond_wait(vlc_cond_t *p_condvar, vlc_mutex_t *p_mutex)
Waits on a condition variable.
Definition: thread.c:267
vlc_mutex_unlock
void vlc_mutex_unlock(vlc_mutex_t *p_mutex)
Releases a mutex.
Definition: thread.c:138
vlc_mutex_lock
void vlc_mutex_lock(vlc_mutex_t *p_mutex)
Acquires a mutex.
Definition: thread.c:123
mutex_cleanup_push
#define mutex_cleanup_push(lock)
Definition: vlc_threads.h:1013