Index: src/untrusted/pthread/pthread.h |
diff --git a/src/untrusted/pthread/pthread.h b/src/untrusted/pthread/pthread.h |
index eb495280aba765a6f5329e9cd36f57b433fd0b8d..24ada874f221d98af1f26105c07fc89991c8998a 100644 |
--- a/src/untrusted/pthread/pthread.h |
+++ b/src/untrusted/pthread/pthread.h |
@@ -129,6 +129,27 @@ typedef struct { |
int dummy; /**< Reserved; condition variables don't have attributes */ |
} pthread_condattr_t; |
+/** |
+ * A structure representing a rwlock. It should be considered an |
+ * opaque record; the names of the fields can change anytime. |
+ */ |
+typedef struct { |
+ pthread_mutex_t mutex; /* mutex for all values in the structure */ |
+ int reader_count; |
+ int writers_waiting; |
+ struct __nc_basic_thread_data *writer_thread_id; |
+ pthread_cond_t read_possible; |
+ pthread_cond_t write_possible; |
+} pthread_rwlock_t; |
+ |
+/** |
+ * A structure representing rwlock attributes. It should be considered an |
+ * opaque record. |
+ */ |
+typedef struct { |
+ int type; |
+} pthread_rwlockattr_t; |
+ |
/** A value that represents an uninitialized handle. */ |
#define NC_INVALID_HANDLE -1 |
@@ -153,7 +174,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 |
Mark Seaborn
2014/12/01 22:33:07
Nit: add empty line to maintain spacing between se
Sam Clegg
2014/12/10 19:17:43
Done.
|
/* Functions for mutex handling. */ |
@@ -376,6 +398,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); |
Mark Seaborn
2014/12/01 22:33:07
Nit: add empty line to maintain spacing between se
Sam Clegg
2014/12/10 19:17:43
Done.
|
/* Threads */ |
/** Thread entry function type. */ |