mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-11-01 23:04:54 +01:00
Add annotations used by clang's -Wthread-safety. Fix dsos compilation errors caused by a lock of annotations. Signed-off-by: Ian Rogers <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Athira Rajeev <[email protected]> Cc: Bill Wendling <[email protected]> Cc: Chaitanya S Prakash <[email protected]> Cc: Fei Lang <[email protected]> Cc: Howard Chu <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: James Clark <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Justin Stitt <[email protected]> Cc: Kan Liang <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Nathan Chancellor <[email protected]> Cc: Nick Desaulniers <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Stephen Brennan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
31 lines
706 B
C
31 lines
706 B
C
#ifndef _PERF_RWSEM_H
|
|
#define _PERF_RWSEM_H
|
|
|
|
#include <pthread.h>
|
|
#include "mutex.h"
|
|
|
|
/*
|
|
* Mutexes have additional error checking. Enable to use a mutex rather than a
|
|
* rwlock for debugging.
|
|
*/
|
|
#define RWS_ERRORCHECK 0
|
|
|
|
struct LOCKABLE rw_semaphore {
|
|
#if RWS_ERRORCHECK
|
|
struct mutex mtx;
|
|
#else
|
|
pthread_rwlock_t lock;
|
|
#endif
|
|
};
|
|
|
|
int init_rwsem(struct rw_semaphore *sem);
|
|
int exit_rwsem(struct rw_semaphore *sem);
|
|
|
|
int down_read(struct rw_semaphore *sem) SHARED_LOCK_FUNCTION(sem);
|
|
int up_read(struct rw_semaphore *sem) UNLOCK_FUNCTION(sem);
|
|
|
|
int down_write(struct rw_semaphore *sem) EXCLUSIVE_LOCK_FUNCTION(sem);
|
|
int up_write(struct rw_semaphore *sem) UNLOCK_FUNCTION(sem);
|
|
|
|
#endif /* _PERF_RWSEM_H */
|