A fair reader writer lock. More...
A fair reader writer lock.
The implementation ensures that readers and writers of the same priority won't starve each other. E.g. no new readers will get into the critical section if a writer of the same or a higher priority already waits for the lock.
Definition at line 37 of file pthread_rwlock.h.
#include <pthread_rwlock.h>
Data Fields | |
int | readers |
The current amount of reader inside the critical section. | |
priority_queue_t | queue |
Queue of waiting threads. | |
mutex_t | mutex |
Provides mutual exclusion on reading and writing on the structure. | |
mutex_t pthread_rwlock_t::mutex |
Provides mutual exclusion on reading and writing on the structure.
Definition at line 56 of file pthread_rwlock.h.
priority_queue_t pthread_rwlock_t::queue |
Queue of waiting threads.
Definition at line 51 of file pthread_rwlock.h.
int pthread_rwlock_t::readers |
The current amount of reader inside the critical section.
== 0
: no thread is in the critical section.> 0
: the number of readers currently in the critical section.< 0
: a writer is currently in the critical section. Definition at line 46 of file pthread_rwlock.h.