From aa347029da5b7964f649964700e0390f84020d98 Mon Sep 17 00:00:00 2001 From: Gert Wollny Date: Mon, 8 Apr 2024 14:59:30 +0200 Subject: [PATCH] futex: disable futexes when compiling with tsan Thread sanitizer doesn't support futexes, so don't use them in this case and fall back to standard mutexes. With that we can avoid tsan reporting a large number of false positives. v2: use #if instead of #ifdef to test the value of the define Signed-off-by: Gert Wollny Part-of: --- src/util/futex.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/util/futex.h b/src/util/futex.h index 31e56b916ff..b7ce0884155 100644 --- a/src/util/futex.h +++ b/src/util/futex.h @@ -24,6 +24,9 @@ #ifndef UTIL_FUTEX_H #define UTIL_FUTEX_H +#if THREAD_SANITIZER +#define UTIL_FUTEX_SUPPORTED 0 +#else #if defined(HAVE_LINUX_FUTEX_H) && defined(__linux__) #define UTIL_FUTEX_SUPPORTED 1 #elif defined(__FreeBSD__) @@ -35,6 +38,7 @@ #else #define UTIL_FUTEX_SUPPORTED 0 #endif +#endif #if UTIL_FUTEX_SUPPORTED #include