diff options
author | Derek Mauro <dmauro@google.com> | 2023-04-12 13:26:48 -0700 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2023-04-12 13:27:28 -0700 |
commit | c23acb9b5636e7b908fba03d6b3584d8f80dba6d (patch) | |
tree | cc2332512cecd0d3efb2f3819516fb6d7af44bc6 /absl/synchronization/internal/pthread_waiter.cc | |
parent | 32d314d0f5bb0ca3ff71ece49c71a728c128d43e (diff) | |
download | abseil-c23acb9b5636e7b908fba03d6b3584d8f80dba6d.tar.gz abseil-c23acb9b5636e7b908fba03d6b3584d8f80dba6d.tar.bz2 abseil-c23acb9b5636e7b908fba03d6b3584d8f80dba6d.zip |
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/pthread_waiter.cc')
-rw-r--r-- | absl/synchronization/internal/pthread_waiter.cc | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/absl/synchronization/internal/pthread_waiter.cc b/absl/synchronization/internal/pthread_waiter.cc index 8d90cc45..366aaea2 100644 --- a/absl/synchronization/internal/pthread_waiter.cc +++ b/absl/synchronization/internal/pthread_waiter.cc @@ -88,14 +88,8 @@ PthreadWaiter::PthreadWaiter() : waiter_count_(0), wakeup_count_(0) { // KernelTimeout requested. The return value is the same as the return // value of pthread_cond_timedwait(). int PthreadWaiter::TimedWait(KernelTimeout t) { -#ifndef __GOOGLE_GRTE_VERSION__ - constexpr bool kRelativeTimeoutSupported = true; -#else - constexpr bool kRelativeTimeoutSupported = false; -#endif - assert(t.has_timeout()); - if (kRelativeTimeoutSupported && t.is_relative_timeout()) { + if (KernelTimeout::SupportsSteadyClock() && t.is_relative_timeout()) { #ifdef ABSL_INTERNAL_HAS_PTHREAD_COND_TIMEDWAIT_RELATIVE_NP const auto rel_timeout = t.MakeRelativeTimespec(); return pthread_cond_timedwait_relative_np(&cv_, &mu_, &rel_timeout); |