[PATCH v2] libstdc++: Fix errors in atomic timed waiting functions
Jonathan Wakely
jwakely@redhat.com
Tue Jun 3 10:03:03 GMT 2025
These function templates are apparently never used or instantiated,
because they don't compile. This fixes them, but they're still unused.
I plan to make use of them in a later commit.
In __atomic_wait_address_until_v, the &__args should have bee changed to
just __args by r16-988-g219bb905a60d95, and __res.first in the return
statement should have been changed when r16-1000-g225622398a9631 changed
the return type from a std::pair to a struct with three members.
In __atomic_wait_address_for_v, the parameter is a copy & paste error
and should use chrono::duration not chrono::time_point
libstdc++-v3/ChangeLog:
* include/bits/atomic_timed_wait.h (__atomic_wait_address_until_v):
Do not take address of __args in call to __detail::__wait_until.
Fix return statement to refer to member of __wait_result_type.
(__atomic_wait_address_for_v): Change parameter type from time_point
to duration.
---
Patch v2 adds the __res.first change to this patch, which was previously
included in a different patch. It makes more sense to combine that with
this patch.
Tested x86_64-linux.
libstdc++-v3/include/bits/atomic_timed_wait.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/libstdc++-v3/include/bits/atomic_timed_wait.h b/libstdc++-v3/include/bits/atomic_timed_wait.h
index 71638fd59a05..bd2e6bf61ecf 100644
--- a/libstdc++-v3/include/bits/atomic_timed_wait.h
+++ b/libstdc++-v3/include/bits/atomic_timed_wait.h
@@ -157,8 +157,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
bool __bare_wait = false) noexcept
{
__detail::__wait_args __args{ __addr, __old, __order, __bare_wait };
- auto __res = __detail::__wait_until(__addr, &__args, __atime);
- return __res.first; // C++26 will also return last observed __val
+ auto __res = __detail::__wait_until(__addr, __args, __atime);
+ return !__res._M_timeout; // C++26 will also return last observed __val
}
template<typename _Tp, typename _ValFn,
@@ -202,7 +202,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__atomic_wait_address_for_v(const __detail::__platform_wait_t* __addr,
__detail::__platform_wait_t __old,
int __order,
- const chrono::time_point<_Rep, _Period>& __rtime,
+ const chrono::duration<_Rep, _Period>& __rtime,
bool __bare_wait = false) noexcept
{
__detail::__wait_args __args{ __addr, __old, __order, __bare_wait };
--
2.49.0
More information about the Libstdc++
mailing list