VLC
4.0.0-dev
|
Macros | |
#define | VLC_THREAD_ASSERT(action) |
#define | VLC_STACKSIZE (128 * sizeof (void *) * 1024) |
Functions | |
static void | vlc_clock_setup_once (void) |
void | vlc_trace (const char *fn, const char *file, unsigned line) |
Print a backtrace to the standard error for debugging purpose. More... | |
static void | vlc_thread_fatal (const char *action, int error, const char *function, const char *file, unsigned line) |
Reports a fatal error from the threading layer, for debugging purposes. More... | |
void | vlc_rwlock_init (vlc_rwlock_t *lock) |
Initializes a read/write lock. More... | |
void | vlc_rwlock_destroy (vlc_rwlock_t *lock) |
Destroys an initialized unused read/write lock. More... | |
void | vlc_rwlock_rdlock (vlc_rwlock_t *lock) |
Acquires a read/write lock for reading. More... | |
void | vlc_rwlock_wrlock (vlc_rwlock_t *lock) |
Acquires a read/write lock for writing. More... | |
void | vlc_rwlock_unlock (vlc_rwlock_t *lock) |
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 *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... | |
void | vlc_threads_setup (libvlc_int_t *p_libvlc) |
static int | vlc_clone_attr (vlc_thread_t *th, pthread_attr_t *attr, void *(*entry)(void *), void *data, int priority) |
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 th, 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) |
Creates and starts new detached thread. More... | |
unsigned long | vlc_thread_id (void) |
Thread identifier. More... | |
int | vlc_set_priority (vlc_thread_t th, int priority) |
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... | |
vlc_tick_t | vlc_tick_now (void) |
Precision monotonic clock. More... | |
void | vlc_tick_wait (vlc_tick_t deadline) |
Waits until a deadline. More... | |
void | vlc_tick_sleep (vlc_tick_t delay) |
Waits for an interval of time. More... | |
unsigned | vlc_GetCPUCount (void) |
Count CPUs. More... | |
Variables | |
static unsigned | vlc_clock_prec |
#define VLC_STACKSIZE (128 * sizeof (void *) * 1024) |
Referenced by vlc_clone_attr().
#define VLC_THREAD_ASSERT | ( | action | ) |
Referenced by vlc_join(), vlc_restorecancel(), vlc_rwlock_destroy(), vlc_rwlock_rdlock(), vlc_rwlock_unlock(), vlc_rwlock_wrlock(), and vlc_savecancel().
|
static |
References timespec::tv_nsec, timespec::tv_sec, unlikely, and vlc_clock_prec.
Referenced by vlc_tick_wait().
|
static |
References vlc_thread_t::handle, and VLC_STACKSIZE.
Referenced by vlc_clone(), and vlc_clone_detach().
int vlc_clone_detach | ( | vlc_thread_t * | th, |
void *(*)(void *) | entry, | ||
void * | data, | ||
int | priority | ||
) |
Creates and starts new detached thread.
A detached thread cannot be joined. Its resources will be automatically released whenever the thread exits (in particular, its call stack will be reclaimed).
Detached thread are particularly useful when some work needs to be done asynchronously, that is likely to be completed much earlier than the thread can practically be joined. In this case, thread detach can spare memory.
A detached thread may be cancelled, so as to expedite its termination. Be extremely careful if you do this: while a normal joinable thread can safely be cancelled after it has already exited, cancelling an already exited detached thread is undefined: The thread handle would is destroyed immediately when the detached thread exits. So you need to ensure that the detached thread is still running before cancellation is attempted.
th | [OUT] pointer to hold the thread handle, or NULL |
entry | entry point for the thread |
data | data parameter given to the entry point |
priority | thread priority value |
References vlc_clone_attr().
int vlc_set_priority | ( | vlc_thread_t | th, |
int | priority | ||
) |
References VLC_SUCCESS.
|
static |
Reports a fatal error from the threading layer, for debugging purposes.
References vlc_restorecancel(), vlc_savecancel(), vlc_thread_id(), and vlc_trace().
Referenced by vlc_restorecancel().
void vlc_threads_setup | ( | libvlc_int_t * | p_libvlc | ) |
void vlc_trace | ( | const char * | fn, |
const char * | file, | ||
unsigned | line | ||
) |
Print a backtrace to the standard error for debugging purpose.
References ARRAY_SIZE, and fsync().
|
static |
Referenced by vlc_clock_setup_once(), and vlc_tick_wait().