Revert "perf augmented_syscalls: Drop 'write', 'poll' for testing without self pid...
[linux/fpc-iii.git] / tools / perf / util / rwsem.c
blob5e52e7baa7b6599474c4239d11fea2ad57c2649a
1 #include "util.h"
2 #include "rwsem.h"
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);