Mutex-free implementation of pthread_rwlock
Bug: 8133149 Change-Id: Id6775010d95f2634b173daa55d87a59a3cf4131b
This commit is contained in:
@@ -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;
|
||||
|
Reference in New Issue
Block a user