Mstdlib-1.24.0
|
Typedefs | |
typedef struct M_thread_rwlock | M_thread_rwlock_t |
Enumerations | |
enum | M_thread_rwlock_type_t { M_THREAD_RWLOCK_TYPE_READ = 0 , M_THREAD_RWLOCK_TYPE_WRITE } |
Functions | |
M_thread_rwlock_t * | M_thread_rwlock_create (void) |
void | M_thread_rwlock_destroy (M_thread_rwlock_t *rwlock) |
M_bool | M_thread_rwlock_lock (M_thread_rwlock_t *rwlock, M_thread_rwlock_type_t type) |
M_bool | M_thread_rwlock_unlock (M_thread_rwlock_t *rwlock) |
Read/Write locks
typedef struct M_thread_rwlock M_thread_rwlock_t |
M_thread_rwlock_t * M_thread_rwlock_create | ( | void | ) |
Read/Write lock create.
Read/Write locks allow multiple readers to be hold the lock at the same time. A write lock will be allowed once all readers have released their locks.
For new locks waiting writers are preferred. Meaning a if a writer is waiting new read locks will not be given until all waiting writers has received and released their locks.
void M_thread_rwlock_destroy | ( | M_thread_rwlock_t * | rwlock | ) |
Destroy a read/write lock.
[in] | rwlock | The lock. |
M_bool M_thread_rwlock_lock | ( | M_thread_rwlock_t * | rwlock, |
M_thread_rwlock_type_t | type | ||
) |
Lock a read/write lock.
The thread will block waiting to acquire the lock.
[in] | rwlock | The lock. |
[in] | type | The type of lock to acquire. |
M_bool M_thread_rwlock_unlock | ( | M_thread_rwlock_t * | rwlock | ) |
Unlock a read/write lock.
[in] | rwlock | The lock. |