[committed] libstdc++: Only support atomic_ref::wait tests which are always lockfree
Thomas Rodgers
rodgert@appliantology.com
Wed Jun 9 20:52:36 GMT 2021
Fixes a regression on arm32 targets.
libstdc++/ChangeLog:
* testsuite/29_atomics/atomic_ref/wait_notify.cc: Guard
test logic with constexpr check for is_always_lock_free.
As discussed on IRC.
Tested x86_64-pc-linux-gnu, committed to master, backported to
releases/gcc-11.
---
.../29_atomics/atomic_ref/wait_notify.cc | 23 +++++++++++--------
1 file changed, 13 insertions(+), 10 deletions(-)
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_ref/wait_notify.cc b/libstdc++-v3/testsuite/29_atomics/atomic_ref/wait_notify.cc
index 2500dddf884..c21c3a11ab5 100644
--- a/libstdc++-v3/testsuite/29_atomics/atomic_ref/wait_notify.cc
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_ref/wait_notify.cc
@@ -30,17 +30,20 @@ template<typename S>
void
test (S va, S vb)
{
- S aa{ va };
- S bb{ vb };
- std::atomic_ref<S> a{ aa };
- a.wait(bb);
- std::thread t([&]
+ if constexpr (std::atomic_ref<S>::is_always_lock_free)
{
- a.store(bb);
- a.notify_one();
- });
- a.wait(aa);
- t.join();
+ S aa{ va };
+ S bb{ vb };
+ std::atomic_ref<S> a{ aa };
+ a.wait(bb);
+ std::thread t([&]
+ {
+ a.store(bb);
+ a.notify_one();
+ });
+ a.wait(aa);
+ t.join();
+ }
}
int
--
2.26.2
More information about the Gcc-patches
mailing list