P99
|
A simple rwlock implementation. More...
#include <p99_rwl.h>
Related Functions | |
(Note that these are not member functions.) | |
bool | p99_rwl_haswaiters (p99_rwl volatile *p00_r) |
Tell if has waiters. More... | |
bool | p99_rwl_islocked (p99_rwl volatile *p00_r) |
Tell if is locked. More... | |
int | p99_rwl_rdlock (p99_rwl volatile *p00_r) |
establish a shared lock for rwlock p00_c. More... | |
int | p99_rwl_unlock (p99_rwl volatile *p00_r) |
release a lock on rwlock p00_r. More... | |
int | p99_rwl_wrlock (p99_rwl volatile *p00_r) |
establish an exclusive lock for rwlock p00_r. More... | |
A simple rwlock implementation.
This is implemented more or less efficiently according to the features that the platform provides:
It has the following properties:
As a consequence, this form of lock can be easily cleaned up if a thread has left it locked and then walked away:
This takes care of all situations where no other thread actively is trying to achieve the lock.