Add pthread_rwlock_t implementation to the C library (DO NOT MERGE)
Change-Id: I756d8c26afc37cd7b71117ddbaa02a2cb40fdecb
This commit is contained in:

committed by
Mathias Agopian

parent
8e1ee7fd01
commit
8a1d2cf142
@@ -219,6 +219,41 @@ int pthread_cond_timeout_np(pthread_cond_t *cond,
|
||||
*/
|
||||
int pthread_mutex_lock_timeout_np(pthread_mutex_t *mutex, unsigned msecs);
|
||||
|
||||
/* read-write lock support */
|
||||
|
||||
typedef int pthread_rwlockattr_t;
|
||||
|
||||
typedef struct {
|
||||
pthread_mutex_t lock;
|
||||
pthread_cond_t cond;
|
||||
int numLocks;
|
||||
int writerThreadId;
|
||||
int pendingReaders;
|
||||
int pendingWriters;
|
||||
void* reserved[4]; /* for future extensibility */
|
||||
} pthread_rwlock_t;
|
||||
|
||||
#define PTHREAD_RWLOCK_INITIALIZER { PTHREAD_MUTEX_INITIALIZER, 0, NULL, 0, 0 }
|
||||
|
||||
int pthread_rwlockattr_init(pthread_rwlockattr_t *attr);
|
||||
int pthread_rwlockattr_destroy(pthread_rwlockattr_t *attr);
|
||||
int pthread_rwlockattr_setpshared(pthread_rwlockattr_t *attr, int pshared);
|
||||
int pthread_rwlockattr_getpshared(pthread_rwlockattr_t *attr, int *pshared);
|
||||
|
||||
int pthread_rwlock_init(pthread_rwlock_t *rwlock, const pthread_rwlockattr_t *attr);
|
||||
int pthread_rwlock_destroy(pthread_rwlock_t *rwlock);
|
||||
|
||||
int pthread_rwlock_rdlock(pthread_rwlock_t *rwlock);
|
||||
int pthread_rwlock_tryrdlock(pthread_rwlock_t *rwlock);
|
||||
int pthread_rwlock_timedrdlock(pthread_rwlock_t *rwlock, const struct timespec *abs_timeout);
|
||||
|
||||
int pthread_rwlock_wrlock(pthread_rwlock_t *rwlock);
|
||||
int pthread_rwlock_trywrlock(pthread_rwlock_t *rwlock);
|
||||
int pthread_rwlock_timedwrlock(pthread_rwlock_t *rwlock, const struct timespec *abs_timeout);
|
||||
|
||||
int pthread_rwlock_unlock(pthread_rwlock_t *rwlock);
|
||||
|
||||
|
||||
int pthread_key_create(pthread_key_t *key, void (*destructor_function)(void *));
|
||||
int pthread_key_delete (pthread_key_t);
|
||||
int pthread_setspecific(pthread_key_t key, const void *value);
|
||||
|
Reference in New Issue
Block a user