4 int init_rwsem(struct rw_semaphore *sem)
6 return pthread_rwlock_init(&sem->lock, NULL);
9 int exit_rwsem(struct rw_semaphore *sem)
11 return pthread_rwlock_destroy(&sem->lock);
14 int down_read(struct rw_semaphore *sem)
16 return perf_singlethreaded ? 0 : pthread_rwlock_rdlock(&sem->lock);
19 int up_read(struct rw_semaphore *sem)
21 return perf_singlethreaded ? 0 : pthread_rwlock_unlock(&sem->lock);
24 int down_write(struct rw_semaphore *sem)
26 return perf_singlethreaded ? 0 : pthread_rwlock_wrlock(&sem->lock);
29 int up_write(struct rw_semaphore *sem)
31 return perf_singlethreaded ? 0 : pthread_rwlock_unlock(&sem->lock);