1 #ifndef _PERF_RWSEM_H 1 #ifndef _PERF_RWSEM_H 2 #define _PERF_RWSEM_H 2 #define _PERF_RWSEM_H 3 3 4 #include <pthread.h> 4 #include <pthread.h> 5 #include "mutex.h" << 6 << 7 /* << 8 * Mutexes have additional error checking. Ena << 9 * rwlock for debugging. << 10 */ << 11 #define RWS_ERRORCHECK 0 << 12 5 13 struct rw_semaphore { 6 struct rw_semaphore { 14 #if RWS_ERRORCHECK << 15 struct mutex mtx; << 16 #else << 17 pthread_rwlock_t lock; 7 pthread_rwlock_t lock; 18 #endif << 19 }; 8 }; 20 9 21 int init_rwsem(struct rw_semaphore *sem); 10 int init_rwsem(struct rw_semaphore *sem); 22 int exit_rwsem(struct rw_semaphore *sem); 11 int exit_rwsem(struct rw_semaphore *sem); 23 12 24 int down_read(struct rw_semaphore *sem); 13 int down_read(struct rw_semaphore *sem); 25 int up_read(struct rw_semaphore *sem); 14 int up_read(struct rw_semaphore *sem); 26 15 27 int down_write(struct rw_semaphore *sem); 16 int down_write(struct rw_semaphore *sem); 28 int up_write(struct rw_semaphore *sem); 17 int up_write(struct rw_semaphore *sem); 29 18 30 #endif /* _PERF_RWSEM_H */ 19 #endif /* _PERF_RWSEM_H */ 31 20
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.