]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Use chrono::nanoseconds for __wait_until_impl parameter
authorJonathan Wakely <jwakely@redhat.com>
Mon, 1 Dec 2025 12:54:50 +0000 (12:54 +0000)
committerJonathan Wakely <redi@gcc.gnu.org>
Mon, 1 Dec 2025 12:58:16 +0000 (12:58 +0000)
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.

libstdc++-v3/include/bits/atomic_timed_wait.h
libstdc++-v3/src/c++20/atomic.cc

index 5b31580506688187b96ee443557865d0881c991c..3c3aa2cc114ca7057a2f0929f9f18ee38fb6ef8e 100644 (file)
@@ -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
index 16fd91b7d7ab719c5f6c8c53e0a5f6ed12f1acbc..f5b6d0d826ee2fc266344f5909172cfae3221aae 100644 (file)
@@ -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);