Skip to content

Commit

Permalink
Detect tsan safely
Browse files Browse the repository at this point in the history
Summary: Detecting that tsan is running needs to be done more carefully.

Reviewed By: hanghu

Differential Revision: D65994754
  • Loading branch information
Georges Berenger authored and facebook-github-bot committed Nov 15, 2024
1 parent 3c709a8 commit 082577c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion vrs/utils/converters/Raw10ToGrey10Converter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@

#include <vrs/os/CompilerAttributes.h>

#if defined(__SANITIZE_THREAD__)
#define TSAN_ENABLED
#elif defined(__has_feature)
#if __has_feature(thread_sanitizer)
#define TSAN_ENABLED
#endif
#endif

namespace vrs::utils {

// enforce local linkage
Expand Down Expand Up @@ -208,7 +216,7 @@ bool convertRaw10ToGrey10(

const bool canVectorize = kHasSimdAcceleration && (contiguous || canFullyVectorizeRows);

#if defined(__has_feature) && __has_feature(thread_sanitizer)
#ifdef TSAN_ENABLED
const bool tsan = true;
#else
const bool tsan = false;
Expand Down

0 comments on commit 082577c

Please sign in to comment.