public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r11-8537] libstd++: Only support atomic_ref::wait tests which are always lockfree
@ 2021-06-09 20:47 Thomas Rodgers
  0 siblings, 0 replies; only message in thread
From: Thomas Rodgers @ 2021-06-09 20:47 UTC (permalink / raw)
  To: gcc-cvs, libstdc++-cvs

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-06-09 20:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-09 20:47 [gcc r11-8537] libstd++: Only support atomic_ref::wait tests which are always lockfree Thomas Rodgers

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).