public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r11-9553] libstdc++: Strengthen memory order for atomic<T>::wait/notify
@ 2022-02-10 18:22 Thomas Rodgers
  0 siblings, 0 replies; only message in thread
From: Thomas Rodgers @ 2022-02-10 18:22 UTC (permalink / raw)
  To: gcc-cvs, libstdc++-cvs

https://gcc.gnu.org/g:0c30241b331e11b7d3bf0ba15747b878d5e9c578

commit r11-9553-g0c30241b331e11b7d3bf0ba15747b878d5e9c578
Author: Thomas Rodgers <rodgert@appliantology.com>
Date:   Thu Feb 10 10:12:36 2022 -0800

    libstdc++: Strengthen memory order for atomic<T>::wait/notify
    
    This changes the memory order used in the spin wait code to match
    that of libc++.
    
    libstdc++-v3/ChangeLog:
            * include/bits/atomic_wait.h (__waiter_base::_S_do_spin,
            __waiter_base::_S_do_spin_v): Change memory order from relaxed
            to acquire.
    
    (cherry picked from commit b25a7c05f120e46a60430dcefe529c72303b7022)

Diff:
---
 libstdc++-v3/include/bits/atomic_wait.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libstdc++-v3/include/bits/atomic_wait.h b/libstdc++-v3/include/bits/atomic_wait.h
index d7ded906360..394f666d02e 100644
--- a/libstdc++-v3/include/bits/atomic_wait.h
+++ b/libstdc++-v3/include/bits/atomic_wait.h
@@ -334,7 +334,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	      }
 	    else
 	      {
-		__atomic_load(__addr, &__val, __ATOMIC_RELAXED);
+		__atomic_load(__addr, &__val, __ATOMIC_ACQUIRE);
 	      }
 	    return __atomic_spin(__pred, __spin);
 	  }
@@ -355,7 +355,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 		     __platform_wait_t& __val,
 		     _Spin __spin = _Spin{ })
 	  {
-	    __atomic_load(__addr, &__val, __ATOMIC_RELAXED);
+	    __atomic_load(__addr, &__val, __ATOMIC_ACQUIRE);
 	    return __atomic_spin(__pred, __spin);
 	  }


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

only message in thread, other threads:[~2022-02-10 18:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-10 18:22 [gcc r11-9553] libstdc++: Strengthen memory order for atomic<T>::wait/notify 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).