summaryrefslogtreecommitdiffstats
path: root/libc/include
diff options
context:
space:
mode:
authorDavid 'Digit' Turner <digit@google.com>2010-05-11 16:39:22 -0700
committerMathias Agopian <mathias@google.com>2010-05-19 14:53:18 -0700
commit8a1d2cf1422e35257c160ac5bb12dd3ee481c433 (patch)
tree6307e0ed69c9b22cb49d7702f71d43d1d910e0bf /libc/include
parent8e1ee7fd01986825074ececd39e8c2a5ebc907e0 (diff)
downloadbionic-8a1d2cf1422e35257c160ac5bb12dd3ee481c433.zip
bionic-8a1d2cf1422e35257c160ac5bb12dd3ee481c433.tar.gz
bionic-8a1d2cf1422e35257c160ac5bb12dd3ee481c433.tar.bz2
Add pthread_rwlock_t implementation to the C library (DO NOT MERGE)
Change-Id: I756d8c26afc37cd7b71117ddbaa02a2cb40fdecb
Diffstat (limited to 'libc/include')
-rw-r--r--libc/include/pthread.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/libc/include/pthread.h b/libc/include/pthread.h
index eb2d169..33039b9 100644
--- a/libc/include/pthread.h
+++ b/libc/include/pthread.h
@@ -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);