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

Fix atomic_ref::is_lock_free() on x64 #4729

Merged

Conversation

StephanTLavavej
Copy link
Member

Fixes #4728.

For !_ATOMIC_HAS_DCAS:

  • If we're is_always_lock_free (power of two, at most 1 pointer), return true.
  • Otherwise, we have to be _Is_potentially_lock_free (power of two, at most 2 pointers) and have cmpxchg16b.

For `!_ATOMIC_HAS_DCAS`:
If we're `is_always_lock_free` (power of two, at most 1 pointer), return true.
Otherwise, we have to be `_Is_potentially_lock_free` (power of two, at most 2 pointers) and have cmpxchg16b.
@StephanTLavavej StephanTLavavej added the bug Something isn't working label Jun 16, 2024
@StephanTLavavej StephanTLavavej requested a review from a team as a code owner June 16, 2024 17:22
stl/inc/atomic Outdated Show resolved Hide resolved
Co-authored-by: Alex Guteniev <gutenev@gmail.com>
@StephanTLavavej
Copy link
Member Author

I'm speculatively mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed.

@StephanTLavavej StephanTLavavej merged commit 14b54ca into microsoft:main Jun 27, 2024
39 checks passed
@StephanTLavavej StephanTLavavej deleted the fix-atomic_ref-is_lock_free branch June 27, 2024 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

<atomic>: On x64, atomic_ref::is_lock_free() incorrectly returns true when it shouldn't
3 participants