tsan_mutex_interface.h
Go to the documentation of this file.
1 // Copyright 2017 The Abseil Authors.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // https://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 //
15 // This file is intended solely for spinlock.h.
16 // It provides ThreadSanitizer annotations for custom mutexes.
17 // See <sanitizer/tsan_interface.h> for meaning of these annotations.
18 
19 #ifndef ABSL_BASE_INTERNAL_TSAN_MUTEX_INTERFACE_H_
20 #define ABSL_BASE_INTERNAL_TSAN_MUTEX_INTERFACE_H_
21 
22 // ABSL_INTERNAL_HAVE_TSAN_INTERFACE
23 // Macro intended only for internal use.
24 //
25 // Checks whether LLVM Thread Sanitizer interfaces are available.
26 // First made available in LLVM 5.0 (Sep 2017).
27 #ifdef ABSL_INTERNAL_HAVE_TSAN_INTERFACE
28 #error "ABSL_INTERNAL_HAVE_TSAN_INTERFACE cannot be directly set."
29 #endif
30 
31 #if defined(THREAD_SANITIZER) && defined(__has_include)
32 #if __has_include(<sanitizer/tsan_interface.h>)
33 #define ABSL_INTERNAL_HAVE_TSAN_INTERFACE 1
34 #endif
35 #endif
36 
37 #ifdef ABSL_INTERNAL_HAVE_TSAN_INTERFACE
38 #include <sanitizer/tsan_interface.h>
39 
40 #define ABSL_TSAN_MUTEX_CREATE __tsan_mutex_create
41 #define ABSL_TSAN_MUTEX_DESTROY __tsan_mutex_destroy
42 #define ABSL_TSAN_MUTEX_PRE_LOCK __tsan_mutex_pre_lock
43 #define ABSL_TSAN_MUTEX_POST_LOCK __tsan_mutex_post_lock
44 #define ABSL_TSAN_MUTEX_PRE_UNLOCK __tsan_mutex_pre_unlock
45 #define ABSL_TSAN_MUTEX_POST_UNLOCK __tsan_mutex_post_unlock
46 #define ABSL_TSAN_MUTEX_PRE_SIGNAL __tsan_mutex_pre_signal
47 #define ABSL_TSAN_MUTEX_POST_SIGNAL __tsan_mutex_post_signal
48 #define ABSL_TSAN_MUTEX_PRE_DIVERT __tsan_mutex_pre_divert
49 #define ABSL_TSAN_MUTEX_POST_DIVERT __tsan_mutex_post_divert
50 
51 #else
52 
53 #define ABSL_TSAN_MUTEX_CREATE(...)
54 #define ABSL_TSAN_MUTEX_DESTROY(...)
55 #define ABSL_TSAN_MUTEX_PRE_LOCK(...)
56 #define ABSL_TSAN_MUTEX_POST_LOCK(...)
57 #define ABSL_TSAN_MUTEX_PRE_UNLOCK(...)
58 #define ABSL_TSAN_MUTEX_POST_UNLOCK(...)
59 #define ABSL_TSAN_MUTEX_PRE_SIGNAL(...)
60 #define ABSL_TSAN_MUTEX_POST_SIGNAL(...)
61 #define ABSL_TSAN_MUTEX_PRE_DIVERT(...)
62 #define ABSL_TSAN_MUTEX_POST_DIVERT(...)
63 
64 #endif
65 
66 #endif // ABSL_BASE_INTERNAL_TSAN_MUTEX_INTERFACE_H_


abseil_cpp
Author(s):
autogenerated on Mon Feb 28 2022 21:31:21