public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-7186] libstdc++: Strengthen memory order for atomic<T>::wait/notify
@ 2022-02-10 18:14 Thomas Rodgers
0 siblings, 0 replies; only message in thread
From: Thomas Rodgers @ 2022-02-10 18:14 UTC (permalink / raw)
To: gcc-cvs, libstdc++-cvs
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);
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-02-10 18:14 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:14 [gcc r12-7186] 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).