summaryrefslogtreecommitdiff
path: root/absl/synchronization
diff options
context:
space:
mode:
Diffstat (limited to 'absl/synchronization')
-rw-r--r--absl/synchronization/BUILD.bazel1
-rw-r--r--absl/synchronization/CMakeLists.txt1
-rw-r--r--absl/synchronization/internal/kernel_timeout_test.cc13
-rw-r--r--absl/synchronization/internal/waiter_test.cc10
4 files changed, 17 insertions, 8 deletions
diff --git a/absl/synchronization/BUILD.bazel b/absl/synchronization/BUILD.bazel
index b6721e14..406c5b85 100644
--- a/absl/synchronization/BUILD.bazel
+++ b/absl/synchronization/BUILD.bazel
@@ -351,6 +351,7 @@ cc_test(
":kernel_timeout_internal",
":synchronization",
":thread_pool",
+ "//absl/base:config",
"//absl/random",
"//absl/time",
"@com_google_googletest//:gtest_main",
diff --git a/absl/synchronization/CMakeLists.txt b/absl/synchronization/CMakeLists.txt
index b6b3b27c..86278349 100644
--- a/absl/synchronization/CMakeLists.txt
+++ b/absl/synchronization/CMakeLists.txt
@@ -259,6 +259,7 @@ absl_cc_test(
COPTS
${ABSL_TEST_COPTS}
DEPS
+ absl::config
absl::kernel_timeout_internal
absl::random_random
absl::synchronization
diff --git a/absl/synchronization/internal/kernel_timeout_test.cc b/absl/synchronization/internal/kernel_timeout_test.cc
index e3286f7f..92ed2691 100644
--- a/absl/synchronization/internal/kernel_timeout_test.cc
+++ b/absl/synchronization/internal/kernel_timeout_test.cc
@@ -18,16 +18,19 @@
#include <chrono> // NOLINT(build/c++11)
#include <limits>
-#include "absl/random/random.h"
-#include "gtest/gtest.h"
#include "absl/base/config.h"
+#include "absl/random/random.h"
#include "absl/time/clock.h"
#include "absl/time/time.h"
+#include "gtest/gtest.h"
-// Test go/btm support by randomizing the value clock_gettime() for
+// Test go/btm support by randomizing the value of clock_gettime() for
// CLOCK_MONOTONIC. This works by overriding a weak symbol in glibc.
// We should be resistant to this randomization when !SupportsSteadyClock().
-#ifdef __GOOGLE_GRTE_VERSION__
+#if defined(__GOOGLE_GRTE_VERSION__) && \
+ !defined(ABSL_HAVE_ADDRESS_SANITIZER) && \
+ !defined(ABSL_HAVE_MEMORY_SANITIZER) && \
+ !defined(ABSL_HAVE_THREAD_SANITIZER)
extern "C" int __clock_gettime(clockid_t c, struct timespec* ts);
extern "C" int clock_gettime(clockid_t c, struct timespec* ts) {
@@ -40,7 +43,7 @@ extern "C" int clock_gettime(clockid_t c, struct timespec* ts) {
}
return __clock_gettime(c, ts);
}
-#endif // __GOOGLE_GRTE_VERSION__
+#endif
namespace {
diff --git a/absl/synchronization/internal/waiter_test.cc b/absl/synchronization/internal/waiter_test.cc
index 57a1a3da..9a933940 100644
--- a/absl/synchronization/internal/waiter_test.cc
+++ b/absl/synchronization/internal/waiter_test.cc
@@ -18,6 +18,7 @@
#include <iostream>
#include <ostream>
+#include "absl/base/config.h"
#include "absl/random/random.h"
#include "absl/synchronization/internal/create_thread_identity.h"
#include "absl/synchronization/internal/futex_waiter.h"
@@ -31,10 +32,13 @@
#include "absl/time/time.h"
#include "gtest/gtest.h"
-// Test go/btm support by randomizing the value clock_gettime() for
+// Test go/btm support by randomizing the value of clock_gettime() for
// CLOCK_MONOTONIC. This works by overriding a weak symbol in glibc.
// We should be resistant to this randomization when !SupportsSteadyClock().
-#ifdef __GOOGLE_GRTE_VERSION__
+#if defined(__GOOGLE_GRTE_VERSION__) && \
+ !defined(ABSL_HAVE_ADDRESS_SANITIZER) && \
+ !defined(ABSL_HAVE_MEMORY_SANITIZER) && \
+ !defined(ABSL_HAVE_THREAD_SANITIZER)
extern "C" int __clock_gettime(clockid_t c, struct timespec* ts);
extern "C" int clock_gettime(clockid_t c, struct timespec* ts) {
@@ -47,7 +51,7 @@ extern "C" int clock_gettime(clockid_t c, struct timespec* ts) {
}
return __clock_gettime(c, ts);
}
-#endif // __GOOGLE_GRTE_VERSION__
+#endif
namespace {