diff options
author | Calin Juravle <calin@google.com> | 2014-05-22 10:15:03 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2014-05-22 10:15:03 +0000 |
commit | 172167163af5412c316a8be2f29ca8622984df32 (patch) | |
tree | 6cb3055d2e18fc0a652ba95a4bdc79c072e2637c /libc/include | |
parent | 3d4a7b02cc7948c94932c4d71c68f864457d59d6 (diff) | |
parent | 76f352eec12d8938101e5ae33429c72797c3aa23 (diff) | |
download | bionic-172167163af5412c316a8be2f29ca8622984df32.zip bionic-172167163af5412c316a8be2f29ca8622984df32.tar.gz bionic-172167163af5412c316a8be2f29ca8622984df32.tar.bz2 |
Merge "Mutex-free implementation of pthread_rwlock"
Diffstat (limited to 'libc/include')
-rw-r--r-- | libc/include/pthread.h | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/libc/include/pthread.h b/libc/include/pthread.h index 49f943a..346901a 100644 --- a/libc/include/pthread.h +++ b/libc/include/pthread.h @@ -94,16 +94,17 @@ typedef long pthread_condattr_t; typedef long pthread_rwlockattr_t; typedef struct { - pthread_mutex_t lock; - pthread_cond_t cond; - int numLocks; - int writerThreadId; - int pendingReaders; - int pendingWriters; - void* __reserved[4]; + pthread_mutex_t __unused_lock; + pthread_cond_t __unused_cond; + volatile int32_t state; // 0=unlock, -1=writer lock, +n=reader lock + volatile int32_t writerThreadId; + volatile int32_t pendingReaders; + volatile int32_t pendingWriters; + int32_t attr; + void* __reserved[3]; } pthread_rwlock_t; -#define PTHREAD_RWLOCK_INITIALIZER { PTHREAD_MUTEX_INITIALIZER, PTHREAD_COND_INITIALIZER, 0, 0, 0, 0, { NULL, NULL, NULL, NULL } } +#define PTHREAD_RWLOCK_INITIALIZER { PTHREAD_MUTEX_INITIALIZER, PTHREAD_COND_INITIALIZER, 0, 0, 0, 0, 0, { NULL, NULL, NULL } } typedef int pthread_key_t; typedef long pthread_t; |