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

Use C++11 atomics to avoid undefined behavior. #169

Closed
wants to merge 1 commit into from

Conversation

bbockelm
Copy link
Contributor

C++11 does not guarantee that loads / stores are atomic for any
variable. Using C++11, we force atomicity for the log level - but do not
provide any guarantee about ordering or visibility.

Without this, setting and getting the log level results in undefined
behavior. Undefined behavior results in illegal C++11.

On any known processor and platform, this should be a no-op; however, the
code is now conforming C++11.

C++11 does not guarantee that loads / stores are atomic for any
variable.  Using C++11, we force atomicity for the log level - but do not
provide any guarantee about ordering or visibility.

Without this, setting and getting the log level results in undefined
behavior.  Undefined behavior results in illegal C++11.

On any known processor and platform, this should be a no-op; however, the
code is now conforming C++11.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants