Skip to content

Commit 0c30241

Browse files
author
Thomas Rodgers
committed
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 b25a7c0)
1 parent 3c9a9ce commit 0c30241

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

libstdc++-v3/include/bits/atomic_wait.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
334334
}
335335
else
336336
{
337-
__atomic_load(__addr, &__val, __ATOMIC_RELAXED);
337+
__atomic_load(__addr, &__val, __ATOMIC_ACQUIRE);
338338
}
339339
return __atomic_spin(__pred, __spin);
340340
}
@@ -355,7 +355,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
355355
__platform_wait_t& __val,
356356
_Spin __spin = _Spin{ })
357357
{
358-
__atomic_load(__addr, &__val, __ATOMIC_RELAXED);
358+
__atomic_load(__addr, &__val, __ATOMIC_ACQUIRE);
359359
return __atomic_spin(__pred, __spin);
360360
}
361361

0 commit comments

Comments
 (0)