dispenso
1.4.1
A library for task parallelism
Loading...
Searching...
No Matches
tsan_annotations.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) Meta Platforms, Inc. and affiliates.
3
*
4
* This source code is licensed under the MIT license found in the
5
* LICENSE file in the root directory of this source tree.
6
*/
7
21
#pragma once
22
23
#include <
dispenso/platform.h
>
24
25
#if defined(__SANITIZE_THREAD__)
26
#define DISPENSO_HAS_TSAN 1
27
#elif defined(__has_feature)
28
#if __has_feature(thread_sanitizer)
29
#define DISPENSO_HAS_TSAN 1
30
#else
31
#define DISPENSO_HAS_TSAN 0
32
#endif
// TSAN
33
#else
34
#define DISPENSO_HAS_TSAN 0
35
#endif
// feature
36
37
#if DISPENSO_HAS_TSAN
38
39
namespace
dispenso {
40
namespace
detail {
41
42
DISPENSO_DLL_ACCESS
void
annotateIgnoreWritesBegin(
const
char
* f,
int
l);
43
DISPENSO_DLL_ACCESS
void
annotateIgnoreWritesEnd(
const
char
* f,
int
l);
44
DISPENSO_DLL_ACCESS
void
annotateIgnoreReadsBegin(
const
char
* f,
int
l);
45
DISPENSO_DLL_ACCESS
void
annotateIgnoreReadsEnd(
const
char
* f,
int
l);
46
DISPENSO_DLL_ACCESS
void
47
annotateNewMemory(
const
char
* f,
int
l,
const
volatile
void
* address,
long
size);
48
DISPENSO_DLL_ACCESS
void
annotateHappensBefore(
const
char
* f,
int
l,
const
volatile
void
* address);
49
DISPENSO_DLL_ACCESS
void
annotateHappensAfter(
const
char
* f,
int
l,
const
volatile
void
* address);
50
51
}
// namespace detail
52
}
// namespace dispenso
53
54
#define DISPENSO_TSAN_ANNOTATE_IGNORE_WRITES_BEGIN() \
55
::dispenso::detail::annotateIgnoreWritesBegin(__FILE__, __LINE__)
56
#define DISPENSO_TSAN_ANNOTATE_IGNORE_WRITES_END() \
57
::dispenso::detail::annotateIgnoreWritesEnd(__FILE__, __LINE__)
58
#define DISPENSO_TSAN_ANNOTATE_IGNORE_READS_BEGIN() \
59
::dispenso::detail::annotateIgnoreReadsBegin(__FILE__, __LINE__)
60
#define DISPENSO_TSAN_ANNOTATE_IGNORE_READS_END() \
61
::dispenso::detail::annotateIgnoreReadsEnd(__FILE__, __LINE__)
62
#define DISPENSO_TSAN_ANNOTATE_NEW_MEMORY(address, size) \
63
::dispenso::detail::annotateNewMemory(__FILE__, __LINE__, address, size)
64
#define DISPENSO_TSAN_ANNOTATE_HAPPENS_BEFORE(address) \
65
::dispenso::detail::annotateHappensBefore(__FILE__, __LINE__, address)
66
#define DISPENSO_TSAN_ANNOTATE_HAPPENS_AFTER(address) \
67
::dispenso::detail::annotateHappensAfter(__FILE__, __LINE__, address)
68
69
#else
70
71
#define DISPENSO_TSAN_ANNOTATE_IGNORE_WRITES_BEGIN()
72
#define DISPENSO_TSAN_ANNOTATE_IGNORE_WRITES_END()
73
#define DISPENSO_TSAN_ANNOTATE_IGNORE_READS_BEGIN()
74
#define DISPENSO_TSAN_ANNOTATE_IGNORE_READS_END()
75
#define DISPENSO_TSAN_ANNOTATE_NEW_MEMORY(address, size)
76
#define DISPENSO_TSAN_ANNOTATE_HAPPENS_BEFORE(address)
77
#define DISPENSO_TSAN_ANNOTATE_HAPPENS_AFTER(address)
78
79
#endif
// DISPENSO_HAS_TSAN
platform.h
dispenso
tsan_annotations.h
Generated by
1.12.0