Chromium Code Reviews| Index: src/untrusted/pthread/pthread.h |
| diff --git a/src/untrusted/pthread/pthread.h b/src/untrusted/pthread/pthread.h |
| index eb495280aba765a6f5329e9cd36f57b433fd0b8d..18afd25699354c35f0cbb7468d44bc10743027bc 100644 |
| --- a/src/untrusted/pthread/pthread.h |
| +++ b/src/untrusted/pthread/pthread.h |
| @@ -129,6 +129,24 @@ typedef struct { |
| int dummy; /**< Reserved; condition variables don't have attributes */ |
| } pthread_condattr_t; |
| +/** |
| + * A structure representing rwlock attributes. It should be considered an |
| + * opaque record. |
| + */ |
| +typedef int32_t pthread_rwlockattr_t; |
| + |
| +/** |
| + * A structure representing a rwlock. It should be considered an |
| + * opaque record; the names of the fields can change anytime. |
| + */ |
| +typedef struct { |
| + volatile int32_t state; /* 0=unlock, -1=writer lock, +n=reader lock */ |
| + struct __nc_basic_thread_data *volatile writer_thread_id; |
| + volatile int32_t pending_readers; |
| + volatile int32_t pending_writers; |
| + pthread_rwlockattr_t attr; |
|
Mark Seaborn
2014/10/02 19:58:51
Not actually read, so you can omit this field.
|
| +} pthread_rwlock_t; |
| + |
| /** A value that represents an uninitialized handle. */ |
| #define NC_INVALID_HANDLE -1 |
| @@ -153,7 +171,8 @@ typedef struct { |
| /** Statically initializes a condition variable (pthread_cond_t). */ |
| #define PTHREAD_COND_INITIALIZER {0, NC_INVALID_HANDLE} |
| - |
| +#define PTHREAD_PROCESS_PRIVATE 0 |
| +#define PTHREAD_PROCESS_SHARED 1 |
| /* Functions for mutex handling. */ |
| @@ -376,6 +395,30 @@ int pthread_cond_timedwait_rel(pthread_cond_t *cond, |
| */ |
| #define pthread_cond_timedwait pthread_cond_timedwait_abs |
| +/* Functions for rwlock handling. */ |
| + |
| +int pthread_rwlockattr_init(pthread_rwlockattr_t *attr); |
| +int pthread_rwlockattr_getpshared(const pthread_rwlockattr_t *attr, |
| + int *pshared); |
| +int pthread_rwlockattr_setpshared(pthread_rwlockattr_t *attr, int pshared); |
| +int pthread_rwlockattr_destroy(pthread_rwlockattr_t *attr); |
| + |
| +int pthread_rwlock_init(pthread_rwlock_t *rwlock, |
| + const pthread_rwlockattr_t *attr); |
| + |
| +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 *abstime); |
| + |
| + |
| +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 *abstime); |
| + |
| +int pthread_rwlock_unlock(pthread_rwlock_t *rwlock); |
| +int pthread_rwlock_destroy(pthread_rwlock_t *rwlock); |
| /* Threads */ |
| /** Thread entry function type. */ |