public inbox for libstdc++-cvs@sourceware.org help / color / mirror / Atom feed
From: Thomas Rodgers <rodgertq@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r11-8537] libstd++: Only support atomic_ref::wait tests which are always lockfree Date: Wed, 9 Jun 2021 20:47:27 +0000 (GMT) [thread overview] Message-ID: <20210609204727.1E4593833017@sourceware.org> (raw) https://gcc.gnu.org/g:fe28c123dbdbff41a8e58299335c8b320856cdcd commit r11-8537-gfe28c123dbdbff41a8e58299335c8b320856cdcd Author: Thomas Rodgers <rodgert@appliantology.com> Date: Wed Jun 9 13:44:31 2021 -0700 libstd++: Only support atomic_ref::wait tests which are always lockfree Fixes a regression on arm32 targets. libstdc++-v3/ChangeLog: * testsuite/29_atomics/atomic_ref/wait_notify.cc: Guard test logic with constexpr check for is_always_lock_free. (cherry picked from commit eb3a3bb8ce4ce2420919d03a3e9f9a2a4297c4d3) Diff: --- .../testsuite/29_atomics/atomic_ref/wait_notify.cc | 25 ++++++++++++---------- 1 file changed, 14 insertions(+), 11 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 003b86c85d0..b75e27617f7 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([&] - { - a.store(bb); - a.notify_one(); - }); - a.wait(aa); - t.join(); + if constexpr (std::atomic_ref<S>::is_always_lock_free) + { + 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
reply other threads:[~2021-06-09 20:47 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20210609204727.1E4593833017@sourceware.org \ --to=rodgertq@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ --cc=libstdc++-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).