Use the chrono::nanoseconds typedef instead of the equivalent
__wait_clock_t::duration typedef, and add a comment explaining why we
use a duration not a time_point.

libstdc++-v3/ChangeLog:

        * include/bits/atomic_timed_wait.h (__wait_until_impl): Use
        chrono::nanoseconds for parameter.
        * src/c++20/atomic.cc (__wait_until_impl): Likewise.
---

Tested x86_64-linux. Pushed to trunk.

 libstdc++-v3/include/bits/atomic_timed_wait.h | 7 ++++++-
 libstdc++-v3/src/c++20/atomic.cc              | 2 +-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/libstdc++-v3/include/bits/atomic_timed_wait.h 
b/libstdc++-v3/include/bits/atomic_timed_wait.h
index 5b3158050668..3c3aa2cc114c 100644
--- a/libstdc++-v3/include/bits/atomic_timed_wait.h
+++ b/libstdc++-v3/include/bits/atomic_timed_wait.h
@@ -75,9 +75,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
          return chrono::ceil<__w_dur>(__atime);
       }
 
+    // This uses a nanoseconds duration for the timeout argument.
+    // For __abi_version=0 that is the time since the steady_clock's epoch.
+    // It's possible that in future we will add new __wait_flags constants
+    // to indicate that the timeout is the time since the system_clock epoch,
+    // or is a relative timeout not an absolute time.
     __wait_result_type
     __wait_until_impl(const void* __addr, __wait_args_base& __args,
-                     const __wait_clock_t::duration& __atime);
+                     const chrono::nanoseconds& __timeout);
 
     template<typename _Clock, typename _Dur>
       __wait_result_type
diff --git a/libstdc++-v3/src/c++20/atomic.cc b/libstdc++-v3/src/c++20/atomic.cc
index 16fd91b7d7ab..f5b6d0d826ee 100644
--- a/libstdc++-v3/src/c++20/atomic.cc
+++ b/libstdc++-v3/src/c++20/atomic.cc
@@ -459,7 +459,7 @@ __cond_wait_until(__condvar& __cv, mutex& __mx,
 
 __wait_result_type
 __wait_until_impl([[maybe_unused]] const void* __addr, __wait_args_base& 
__args,
-                 const __wait_clock_t::duration& __time)
+                 const chrono::nanoseconds& __time)
 {
   const __wait_clock_t::time_point __atime(__time);
   auto* __wait_addr = static_cast<const __platform_wait_t*>(__args._M_obj);
-- 
2.52.0

Reply via email to