Skip to content

Commit de9ab52

Browse files
derekmaurocopybara-github
authored andcommitted
No-op changes to relative timeout support code.
PiperOrigin-RevId: 847827629 Change-Id: I84dec0fafa6cdbb8ffee013f9d5ad9b3cb977ee4
1 parent a8960c0 commit de9ab52

File tree

3 files changed

+18
-10
lines changed

3 files changed

+18
-10
lines changed

absl/synchronization/BUILD.bazel

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,7 @@ cc_library(
7272
"//absl/base:core_headers",
7373
"//absl/base:raw_logging_internal",
7474
"//absl/time",
75-
] + select({
76-
"//conditions:default": [],
77-
}),
75+
],
7876
)
7977

8078
cc_test(

absl/synchronization/internal/kernel_timeout.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,8 @@ class KernelTimeout {
129129
std::chrono::nanoseconds ToChronoDuration() const;
130130

131131
// Returns true if steady (aka monotonic) clocks are supported by the system.
132-
// This method exists because go/btm requires synchronized clocks, and
133-
// thus requires we use the system (aka walltime) clock.
132+
// This currently returns true on all platforms, but we have encountered
133+
// platforms that once lacked steady clock support.
134134
static constexpr bool SupportsSteadyClock() { return true; }
135135

136136
private:

absl/synchronization/internal/kernel_timeout_test.cc

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,22 @@
2424
#include "absl/time/time.h"
2525
#include "gtest/gtest.h"
2626

27-
// Test go/btm support by randomizing the value of clock_gettime() for
28-
// CLOCK_MONOTONIC. This works by overriding a weak symbol in glibc.
27+
#if 0 // All supported platforms currently have steady clocks.
28+
#define ABSL_INTERNAL_KERNEL_TIMEOUT_SUPPORTS_STEADY_CLOCK 0
29+
#else
30+
#define ABSL_INTERNAL_KERNEL_TIMEOUT_SUPPORTS_STEADY_CLOCK 1
31+
#endif
32+
33+
static_assert(
34+
absl::synchronization_internal::KernelTimeout::SupportsSteadyClock() ==
35+
static_cast<bool>(ABSL_INTERNAL_KERNEL_TIMEOUT_SUPPORTS_STEADY_CLOCK));
36+
37+
// Randomizing the value of clock_gettime() for CLOCK_MONOTONIC.
38+
// This works by overriding a weak symbol in glibc.
2939
// We should be resistant to this randomization when !SupportsSteadyClock().
30-
#if defined(__GOOGLE_GRTE_VERSION__) && \
31-
!defined(ABSL_HAVE_ADDRESS_SANITIZER) && \
32-
!defined(ABSL_HAVE_MEMORY_SANITIZER) && \
40+
#if !ABSL_INTERNAL_KERNEL_TIMEOUT_SUPPORTS_STEADY_CLOCK && \
41+
!defined(ABSL_HAVE_ADDRESS_SANITIZER) && \
42+
!defined(ABSL_HAVE_MEMORY_SANITIZER) && \
3343
!defined(ABSL_HAVE_THREAD_SANITIZER)
3444
extern "C" int __clock_gettime(clockid_t c, struct timespec* ts);
3545

0 commit comments

Comments
 (0)