1 #ifndef _PERF_RWSEM_H 2 #define _PERF_RWSEM_H 3 4 #include <pthread.h> 5 6 struct rw_semaphore { 7 pthread_rwlock_t lock; 8 }; 9 10 int init_rwsem(struct rw_semaphore *sem); 11 int exit_rwsem(struct rw_semaphore *sem); 12 13 int down_read(struct rw_semaphore *sem); 14 int up_read(struct rw_semaphore *sem); 15 16 int down_write(struct rw_semaphore *sem); 17 int up_write(struct rw_semaphore *sem); 18 19 #endif /* _PERF_RWSEM_H */ 20