Go to the source code of this file.
Defines | |
#define | ARTP_RWLOCKS_H 1 |
#define | RW_INIT(x, y, z, wsem, rsem, wcount, rcount) |
#define | READERS_LOCK(x, y, z, wsem, rsem, wcount, rcount) |
#define | READERS_UNLOCK(x, y, z, wsem, rsem, wcount, rcount) |
#define | WRITERS_LOCK(x, y, z, wsem, rsem, wcount, rcount) |
#define | WRITERS_UNLOCK(x, y, z, wsem, rsem, wcount, rcount) |
|
Value: {\ pthread_mutex_lock(&z);\ pthread_mutex_lock(&rsem);\ pthread_mutex_lock(&x);\ (rcount)++;\ if ((rcount) == 1)\ pthread_mutex_lock(&wsem);\ pthread_mutex_unlock(&x);\ pthread_mutex_unlock(&rsem);\ pthread_mutex_unlock(&z);\ } |
|
Value: {\ pthread_mutex_lock(&x);\ (rcount)--;\ if ((rcount) == 0)\ pthread_mutex_unlock(&wsem);\ pthread_mutex_unlock(&x);\ } |
|
Value: {\ if ((pthread_mutex_init(&x, NULL) != 0)\ || (pthread_mutex_init(&y, NULL) != 0)\ || (pthread_mutex_init(&z, NULL) != 0)\ || (pthread_mutex_init(&wsem, NULL) != 0)\ || (pthread_mutex_init(&rsem, NULL) != 0))\ return E_MEMORY_FAIL;\ wcount = 0;\ rcount = 0;\ } |
|
Value: {\ pthread_mutex_lock(&y);\ (wcount)++;\ if ((wcount) == 1)\ pthread_mutex_lock(&rsem);\ pthread_mutex_unlock(&y);\ pthread_mutex_lock(&wsem);\ } |
|
Value: {\ pthread_mutex_unlock(&wsem);\ pthread_mutex_lock(&y);\ (wcount)--;\ if ((wcount) == 0)\ pthread_mutex_unlock(&rsem);\ pthread_mutex_unlock(&y);\ } |