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 <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28650>
This commit is contained in:
Gert Wollny 2024-04-08 14:59:30 +02:00 committed by Marge Bot
parent 0d46e0e88b
commit aa347029da

View file

@ -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 <stdint.h>