mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-01-31 11:37:35 +00:00
37 lines
1.3 KiB
C
37 lines
1.3 KiB
C
|
#ifndef COSMOPOLITAN_THIRD_PARTY_NSYNC_RACES_INTERNAL_H_
|
||
|
#define COSMOPOLITAN_THIRD_PARTY_NSYNC_RACES_INTERNAL_H_
|
||
|
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||
|
COSMOPOLITAN_C_START_
|
||
|
|
||
|
/* Annotations for race detectors. */
|
||
|
#if defined(__has_feature) && !defined(__SANITIZE_THREAD__)
|
||
|
#if __has_feature(thread_sanitizer) /* used by clang */
|
||
|
#define __SANITIZE_THREAD__ 1 /* GCC uses this; fake it in clang */
|
||
|
#endif
|
||
|
#endif
|
||
|
#if defined(__SANITIZE_THREAD__)
|
||
|
NSYNC_C_START_
|
||
|
void AnnotateIgnoreWritesBegin(const char *file, int line);
|
||
|
void AnnotateIgnoreWritesEnd(const char *file, int line);
|
||
|
void AnnotateIgnoreReadsBegin(const char *file, int line);
|
||
|
void AnnotateIgnoreReadsEnd(const char *file, int line);
|
||
|
NSYNC_C_END_
|
||
|
#define IGNORE_RACES_START() \
|
||
|
do { \
|
||
|
AnnotateIgnoreReadsBegin(__FILE__, __LINE__); \
|
||
|
AnnotateIgnoreWritesBegin(__FILE__, __LINE__); \
|
||
|
} while (0)
|
||
|
#define IGNORE_RACES_END() \
|
||
|
do { \
|
||
|
AnnotateIgnoreWritesEnd(__FILE__, __LINE__); \
|
||
|
AnnotateIgnoreReadsEnd(__FILE__, __LINE__); \
|
||
|
} while (0)
|
||
|
#else
|
||
|
#define IGNORE_RACES_START()
|
||
|
#define IGNORE_RACES_END()
|
||
|
#endif
|
||
|
|
||
|
COSMOPOLITAN_C_END_
|
||
|
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||
|
#endif /* COSMOPOLITAN_THIRD_PARTY_NSYNC_RACES_INTERNAL_H_ */
|