34 #ifndef ABSL_BASE_THREAD_ANNOTATIONS_H_ 35 #define ABSL_BASE_THREAD_ANNOTATIONS_H_ 37 #if defined(__clang__) 38 #define THREAD_ANNOTATION_ATTRIBUTE__(x) __attribute__((x)) 40 #define THREAD_ANNOTATION_ATTRIBUTE__(x) // no-op 60 #define GUARDED_BY(x) THREAD_ANNOTATION_ATTRIBUTE__(guarded_by(x)) 82 #define PT_GUARDED_BY(x) THREAD_ANNOTATION_ATTRIBUTE__(pt_guarded_by(x)) 99 #define ACQUIRED_AFTER(...) \ 100 THREAD_ANNOTATION_ATTRIBUTE__(acquired_after(__VA_ARGS__)) 102 #define ACQUIRED_BEFORE(...) \ 103 THREAD_ANNOTATION_ATTRIBUTE__(acquired_before(__VA_ARGS__)) 128 #define EXCLUSIVE_LOCKS_REQUIRED(...) \ 129 THREAD_ANNOTATION_ATTRIBUTE__(exclusive_locks_required(__VA_ARGS__)) 131 #define SHARED_LOCKS_REQUIRED(...) \ 132 THREAD_ANNOTATION_ATTRIBUTE__(shared_locks_required(__VA_ARGS__)) 139 #define LOCKS_EXCLUDED(...) \ 140 THREAD_ANNOTATION_ATTRIBUTE__(locks_excluded(__VA_ARGS__)) 147 #define LOCK_RETURNED(x) \ 148 THREAD_ANNOTATION_ATTRIBUTE__(lock_returned(x)) 154 THREAD_ANNOTATION_ATTRIBUTE__(lockable) 163 #define SCOPED_LOCKABLE \ 164 THREAD_ANNOTATION_ATTRIBUTE__(scoped_lockable) 170 #define EXCLUSIVE_LOCK_FUNCTION(...) \ 171 THREAD_ANNOTATION_ATTRIBUTE__(exclusive_lock_function(__VA_ARGS__)) 177 #define SHARED_LOCK_FUNCTION(...) \ 178 THREAD_ANNOTATION_ATTRIBUTE__(shared_lock_function(__VA_ARGS__)) 184 #define UNLOCK_FUNCTION(...) \ 185 THREAD_ANNOTATION_ATTRIBUTE__(unlock_function(__VA_ARGS__)) 195 #define EXCLUSIVE_TRYLOCK_FUNCTION(...) \ 196 THREAD_ANNOTATION_ATTRIBUTE__(exclusive_trylock_function(__VA_ARGS__)) 198 #define SHARED_TRYLOCK_FUNCTION(...) \ 199 THREAD_ANNOTATION_ATTRIBUTE__(shared_trylock_function(__VA_ARGS__)) 205 #define ASSERT_EXCLUSIVE_LOCK(...) \ 206 THREAD_ANNOTATION_ATTRIBUTE__(assert_exclusive_lock(__VA_ARGS__)) 208 #define ASSERT_SHARED_LOCK(...) \ 209 THREAD_ANNOTATION_ATTRIBUTE__(assert_shared_lock(__VA_ARGS__)) 216 #define NO_THREAD_SAFETY_ANALYSIS \ 217 THREAD_ANNOTATION_ATTRIBUTE__(no_thread_safety_analysis) 226 #define TS_UNCHECKED(x) "" 231 #define TS_FIXME(x) "" 238 #define NO_THREAD_SAFETY_ANALYSIS_FIXME NO_THREAD_SAFETY_ANALYSIS 243 #define GUARDED_BY_FIXME(x) 248 #define TS_UNCHECKED_READ(x) thread_safety_analysis::ts_unchecked_read(x) 255 template <
typename T>
260 template <
typename T>
267 #endif // ABSL_BASE_THREAD_ANNOTATIONS_H_
const T & ts_unchecked_read(const T &v) NO_THREAD_SAFETY_ANALYSIS
#define NO_THREAD_SAFETY_ANALYSIS