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 r12-7186] libstdc++: Strengthen memory order for atomic<T>::wait/notify
Date: Thu, 10 Feb 2022 18:14:54 +0000 (GMT)	[thread overview]
Message-ID: <20220210181454.BF0873858D1E@sourceware.org> (raw)

https://gcc.gnu.org/g:b25a7c05f120e46a60430dcefe529c72303b7022

commit r12-7186-gb25a7c05f120e46a60430dcefe529c72303b7022
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.

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 6ce7f9343cf..125b1cad886 100644
--- a/libstdc++-v3/include/bits/atomic_wait.h
+++ b/libstdc++-v3/include/bits/atomic_wait.h
@@ -332,7 +332,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	      }
 	    else
 	      {
-		__atomic_load(__addr, &__val, __ATOMIC_RELAXED);
+		__atomic_load(__addr, &__val, __ATOMIC_ACQUIRE);
 	      }
 	    return __atomic_spin(__pred, __spin);
 	  }
@@ -353,7 +353,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);
 	  }


                 reply	other threads:[~2022-02-10 18:14 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=20220210181454.BF0873858D1E@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: link
Be 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).