Skip to content

Replace deprecated _ReadWriteBarrier with std::atomic_signal_fence in MSVC path#2177

Merged
LebedevRI merged 4 commits intogoogle:mainfrom
qorexdevs:fix-deprecated-readwritebarrier
Apr 24, 2026
Merged

Replace deprecated _ReadWriteBarrier with std::atomic_signal_fence in MSVC path#2177
LebedevRI merged 4 commits intogoogle:mainfrom
qorexdevs:fix-deprecated-readwritebarrier

Conversation

@qorexdevs
Copy link
Copy Markdown
Contributor

_ReadWriteBarrier() has been deprecated since MSVC 2015. This replaces
the three calls in the MSVC DoNotOptimize overloads with
std::atomic_signal_fence(std::memory_order_acq_rel), which is the
standard C++11 equivalent (compiler-only barrier, no hardware fence).

Same function is already used for ClobberMemory() in this file, and
is already included.

Fixes #747

@google-cla
Copy link
Copy Markdown

google-cla Bot commented Apr 23, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Comment thread include/benchmark/utils.h
@qorexdevs
Copy link
Copy Markdown
Contributor Author

@googlebot I signed it!

Copy link
Copy Markdown
Collaborator

@LebedevRI LebedevRI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LG, thank you!

@LebedevRI LebedevRI merged commit b808118 into google:main Apr 24, 2026
84 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

_ReadWriteBarrier() is deprecated in MSVC 2015 (possibly earlier)

3 participants