KEMBAR78
Fix `atomic_ref::is_lock_free()` on x64 by StephanTLavavej · Pull Request #4729 · microsoft/STL · GitHub
Skip to content

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
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
@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