[gcc r11-9553] libstdc++: Strengthen memory order for atomic<T>::wait/notify
Thomas Rodgers
rodgertq@gcc.gnu.org
Thu Feb 10 18:22:05 GMT 2022
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);
}
More information about the Gcc-cvs
mailing list