https://gcc.gnu.org/g:b4d61f1d83f09cd8f3cef26107ec307c0d01c89d

commit r16-5796-gb4d61f1d83f09cd8f3cef26107ec307c0d01c89d
Author: Jonathan Wakely <[email protected]>
Date:   Mon Dec 1 12:54:50 2025 +0000

    libstdc++: Use chrono::nanoseconds for __wait_until_impl parameter
    
    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.

Diff:
---
 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);

Reply via email to