VLC  4.0.0-dev
Typedefs | Functions
Collaboration diagram for Thread-specific variables:


typedef pthread_key_t vlc_threadvar_t
 Thread-local key handle. 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...

Detailed Description

Typedef Documentation

◆ vlc_threadvar_t

typedef pthread_key_t vlc_threadvar_t

Thread-local key handle.

Function Documentation

◆ vlc_threadvar_create()

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

Allocates a thread-specific variable.

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.
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, var, 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.

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

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

◆ vlc_threadvar_set()

int vlc_threadvar_set ( vlc_threadvar_t  key,
void *  value 

Sets a thread-specific variable.

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

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