Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

All atomic exchanges with _Api_level should be acq_rel #4288

Merged
merged 1 commit into from
Jan 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions stl/src/atomic_wait.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ namespace {
void _Force_wait_functions_srwlock_only() noexcept {
auto _Local = _Wait_functions._Api_level.load(_STD memory_order_acquire);
if (_Local <= __std_atomic_api_level::__detecting) {
while (!_Wait_functions._Api_level.compare_exchange_weak(_Local, __std_atomic_api_level::__has_srwlock)) {
while (!_Wait_functions._Api_level.compare_exchange_weak(
_Local, __std_atomic_api_level::__has_srwlock, _STD memory_order_acq_rel)) {
if (_Local > __std_atomic_api_level::__detecting) {
return;
}
Expand All @@ -128,7 +129,8 @@ namespace {
}

[[nodiscard]] __std_atomic_api_level _Init_wait_functions(__std_atomic_api_level _Level) {
while (!_Wait_functions._Api_level.compare_exchange_weak(_Level, __std_atomic_api_level::__detecting)) {
while (!_Wait_functions._Api_level.compare_exchange_weak(
_Level, __std_atomic_api_level::__detecting, _STD memory_order_acq_rel)) {
if (_Level > __std_atomic_api_level::__detecting) {
return _Level;
}
Expand Down