Merge tag 'trace-printf-v6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/trace...
[drm/drm-misc.git] / tools / perf / util / rwsem.h
blobef5cbc31d967d64e8fbbf5f142e028abfa8d144e
1 #ifndef _PERF_RWSEM_H
2 #define _PERF_RWSEM_H
4 #include <pthread.h>
5 #include "mutex.h"
7 /*
8 * Mutexes have additional error checking. Enable to use a mutex rather than a
9 * rwlock for debugging.
11 #define RWS_ERRORCHECK 0
13 struct rw_semaphore {
14 #if RWS_ERRORCHECK
15 struct mutex mtx;
16 #else
17 pthread_rwlock_t lock;
18 #endif
21 int init_rwsem(struct rw_semaphore *sem);
22 int exit_rwsem(struct rw_semaphore *sem);
24 int down_read(struct rw_semaphore *sem);
25 int up_read(struct rw_semaphore *sem);
27 int down_write(struct rw_semaphore *sem);
28 int up_write(struct rw_semaphore *sem);
30 #endif /* _PERF_RWSEM_H */