Message ID | 20210609205236.1323202-1-rodgert@appliantology.com |
---|---|
State | New |
Headers | show |
Series | [committed] libstdc++: Only support atomic_ref::wait tests which are always lockfree | expand |
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