Flutter Engine
The Flutter Engine
thread_sanitizer.h
Go to the documentation of this file.
1// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
2// for details. All rights reserved. Use of this source code is governed by a
3// BSD-style license that can be found in the LICENSE file.
4
5#ifndef RUNTIME_PLATFORM_THREAD_SANITIZER_H_
6#define RUNTIME_PLATFORM_THREAD_SANITIZER_H_
7
8#include "platform/globals.h"
9
10#if __SANITIZE_THREAD__
11#define USING_THREAD_SANITIZER
12#elif defined(__has_feature)
13#if __has_feature(thread_sanitizer)
14#define USING_THREAD_SANITIZER
15#endif
16#endif
17
18#if defined(USING_THREAD_SANITIZER)
19#define NO_SANITIZE_THREAD __attribute__((no_sanitize("thread")))
20extern "C" void __tsan_acquire(void* addr);
21extern "C" void __tsan_release(void* addr);
22#else
23#define NO_SANITIZE_THREAD
24#endif
25
26#if defined(USING_THREAD_SANITIZER)
27#define DO_IF_TSAN(CODE) CODE
28#else
29#define DO_IF_TSAN(CODE)
30#endif
31
32#if defined(USING_THREAD_SANITIZER)
33#define DO_IF_NOT_TSAN(CODE)
34#else
35#define DO_IF_NOT_TSAN(CODE) CODE
36#endif
37
38#endif // RUNTIME_PLATFORM_THREAD_SANITIZER_H_
void __tsan_acquire(void *addr)
void __tsan_release(void *addr)