VLC
4.0.0-dev
|
Read/write locks are a type of thread synchronization primitive meant to protect access to data that is mostly read, and rarely written. More...
![]() |
Macros | |
#define | VLC_STATIC_RWLOCK PTHREAD_RWLOCK_INITIALIZER |
Static initializer for (static) read/write lock. More... | |
Typedefs | |
typedef pthread_rwlock_t | vlc_rwlock_t |
Read/write lock. More... | |
Functions | |
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... | |
Read/write locks are a type of thread synchronization primitive meant to protect access to data that is mostly read, and rarely written.
As long as no threads tries to acquire the lock for "writing", any number of threads can acquire the lock for "reading".
See also POSIX pthread_rwlock_t
.
#define VLC_STATIC_RWLOCK PTHREAD_RWLOCK_INITIALIZER |
Static initializer for (static) read/write lock.
typedef pthread_rwlock_t vlc_rwlock_t |
Read/write lock.
Storage space for a slim reader/writer lock.
void vlc_rwlock_destroy | ( | vlc_rwlock_t * | ) |
Destroys an initialized unused read/write lock.
References VLC_THREAD_ASSERT.
Referenced by _DLL_InitTerm(), DllMain(), vlc_cond_timedwait_daytime(), and vlc_LogSwitchClose().
void vlc_rwlock_init | ( | vlc_rwlock_t * | ) |
Initializes a read/write lock.
After use, a read/write lock must be deinitialized with vlc_rwlock_destroy().
References unlikely.
Referenced by _DLL_InitTerm(), DllMain(), vlc_cond_timedwait_daytime(), and vlc_LogSwitchCreate().
void vlc_rwlock_rdlock | ( | vlc_rwlock_t * | ) |
Acquires a read/write lock for reading.
References VLC_THREAD_ASSERT.
Referenced by config_AutoSaveConfigFile(), config_GetFloat(), config_GetInt(), config_GetPsz(), config_SaveConfigFile(), vlc_cond_timedwait_daytime(), and vlc_vaLogSwitch().
void vlc_rwlock_unlock | ( | vlc_rwlock_t * | ) |
Releases a read/write lock.
The calling thread must hold the lock. Otherwise behaviour is undefined.
References VLC_THREAD_ASSERT.
Referenced by config_AutoSaveConfigFile(), config_GetFloat(), config_GetInt(), config_GetPsz(), config_LoadConfigFile(), config_PutFloat(), config_PutInt(), config_PutPsz(), config_ResetAll(), config_SaveConfigFile(), vlc_cond_timedwait_daytime(), vlc_LogSwitch(), and vlc_vaLogSwitch().
void vlc_rwlock_wrlock | ( | vlc_rwlock_t * | ) |
Acquires a read/write lock for writing.
Recursion is not allowed.
References VLC_THREAD_ASSERT.
Referenced by config_LoadConfigFile(), config_PutFloat(), config_PutInt(), config_PutPsz(), config_ResetAll(), vlc_cond_timedwait_daytime(), and vlc_LogSwitch().