summaryrefslogtreecommitdiff
path: root/absl/synchronization/internal/sem_waiter.cc
diff options
context:
space:
mode:
authorGravatar Derek Mauro <dmauro@google.com>2023-04-12 13:26:48 -0700
committerGravatar Copybara-Service <copybara-worker@google.com>2023-04-12 13:27:28 -0700
commitc23acb9b5636e7b908fba03d6b3584d8f80dba6d (patch)
treecc2332512cecd0d3efb2f3819516fb6d7af44bc6 /absl/synchronization/internal/sem_waiter.cc
parent32d314d0f5bb0ca3ff71ece49c71a728c128d43e (diff)
Synchronization: Consolidate the logic for whether steady clocks are supported
for relative timeouts PiperOrigin-RevId: 523789416 Change-Id: Ide4cfdcae9ea7bffca3355c80ea9c8833a9536e6
Diffstat (limited to 'absl/synchronization/internal/sem_waiter.cc')
-rw-r--r--absl/synchronization/internal/sem_waiter.cc8
1 files changed, 1 insertions, 7 deletions
diff --git a/absl/synchronization/internal/sem_waiter.cc b/absl/synchronization/internal/sem_waiter.cc
index 7dd27fb7..3b3849bf 100644
--- a/absl/synchronization/internal/sem_waiter.cc
+++ b/absl/synchronization/internal/sem_waiter.cc
@@ -53,13 +53,7 @@ SemWaiter::SemWaiter() : wakeups_(0) {
// KernelTimeout requested. The return value is the same as a call to the return
// value to a call to sem_timedwait().
int SemWaiter::TimedWait(KernelTimeout t) {
-#ifndef __GOOGLE_GRTE_VERSION__
- constexpr bool kRelativeTimeoutSupported = true;
-#else
- constexpr bool kRelativeTimeoutSupported = false;
-#endif
-
- if (kRelativeTimeoutSupported && t.is_relative_timeout()) {
+ if (KernelTimeout::SupportsSteadyClock() && t.is_relative_timeout()) {
#if defined(ABSL_INTERNAL_HAVE_SEM_CLOCKWAIT) && defined(CLOCK_MONOTONIC)
const auto abs_clock_timeout = t.MakeClockAbsoluteTimespec(CLOCK_MONOTONIC);
return sem_clockwait(&sem_, CLOCK_MONOTONIC, &abs_clock_timeout);