tsan_mutex_interface.h
Go to the documentation of this file.
00001 // Copyright 2017 The Abseil Authors.
00002 //
00003 // Licensed under the Apache License, Version 2.0 (the "License");
00004 // you may not use this file except in compliance with the License.
00005 // You may obtain a copy of the License at
00006 //
00007 //      https://www.apache.org/licenses/LICENSE-2.0
00008 //
00009 // Unless required by applicable law or agreed to in writing, software
00010 // distributed under the License is distributed on an "AS IS" BASIS,
00011 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00012 // See the License for the specific language governing permissions and
00013 // limitations under the License.
00014 //
00015 // This file is intended solely for spinlock.h.
00016 // It provides ThreadSanitizer annotations for custom mutexes.
00017 // See <sanitizer/tsan_interface.h> for meaning of these annotations.
00018 
00019 #ifndef ABSL_BASE_INTERNAL_TSAN_MUTEX_INTERFACE_H_
00020 #define ABSL_BASE_INTERNAL_TSAN_MUTEX_INTERFACE_H_
00021 
00022 // ABSL_INTERNAL_HAVE_TSAN_INTERFACE
00023 // Macro intended only for internal use.
00024 //
00025 // Checks whether LLVM Thread Sanitizer interfaces are available.
00026 // First made available in LLVM 5.0 (Sep 2017).
00027 #ifdef ABSL_INTERNAL_HAVE_TSAN_INTERFACE
00028 #error "ABSL_INTERNAL_HAVE_TSAN_INTERFACE cannot be directly set."
00029 #endif
00030 
00031 #if defined(THREAD_SANITIZER) && defined(__has_include)
00032 #if __has_include(<sanitizer/tsan_interface.h>)
00033 #define ABSL_INTERNAL_HAVE_TSAN_INTERFACE 1
00034 #endif
00035 #endif
00036 
00037 #ifdef ABSL_INTERNAL_HAVE_TSAN_INTERFACE
00038 #include <sanitizer/tsan_interface.h>
00039 
00040 #define ABSL_TSAN_MUTEX_CREATE __tsan_mutex_create
00041 #define ABSL_TSAN_MUTEX_DESTROY __tsan_mutex_destroy
00042 #define ABSL_TSAN_MUTEX_PRE_LOCK __tsan_mutex_pre_lock
00043 #define ABSL_TSAN_MUTEX_POST_LOCK __tsan_mutex_post_lock
00044 #define ABSL_TSAN_MUTEX_PRE_UNLOCK __tsan_mutex_pre_unlock
00045 #define ABSL_TSAN_MUTEX_POST_UNLOCK __tsan_mutex_post_unlock
00046 #define ABSL_TSAN_MUTEX_PRE_SIGNAL __tsan_mutex_pre_signal
00047 #define ABSL_TSAN_MUTEX_POST_SIGNAL __tsan_mutex_post_signal
00048 #define ABSL_TSAN_MUTEX_PRE_DIVERT __tsan_mutex_pre_divert
00049 #define ABSL_TSAN_MUTEX_POST_DIVERT __tsan_mutex_post_divert
00050 
00051 #else
00052 
00053 #define ABSL_TSAN_MUTEX_CREATE(...)
00054 #define ABSL_TSAN_MUTEX_DESTROY(...)
00055 #define ABSL_TSAN_MUTEX_PRE_LOCK(...)
00056 #define ABSL_TSAN_MUTEX_POST_LOCK(...)
00057 #define ABSL_TSAN_MUTEX_PRE_UNLOCK(...)
00058 #define ABSL_TSAN_MUTEX_POST_UNLOCK(...)
00059 #define ABSL_TSAN_MUTEX_PRE_SIGNAL(...)
00060 #define ABSL_TSAN_MUTEX_POST_SIGNAL(...)
00061 #define ABSL_TSAN_MUTEX_PRE_DIVERT(...)
00062 #define ABSL_TSAN_MUTEX_POST_DIVERT(...)
00063 
00064 #endif
00065 
00066 #endif  // ABSL_BASE_INTERNAL_TSAN_MUTEX_INTERFACE_H_


abseil_cpp
Author(s):
autogenerated on Wed Jun 19 2019 19:42:15