Skip to content

Fix atomic_ref::is_lock_free() on x64 - #4729

Merged
Stephan T. Lavavej (StephanTLavavej) merged 3 commits into
microsoft:mainfrom
StephanTLavavej:fix-atomic_ref-is_lock_free
Jun 27, 2024
Merged

Fix atomic_ref::is_lock_free() on x64#4729
Stephan T. Lavavej (StephanTLavavej) merged 3 commits into
microsoft:mainfrom
StephanTLavavej:fix-atomic_ref-is_lock_free

Conversation

@StephanTLavavej

Copy link
Copy Markdown
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.
Comment thread stl/inc/atomic Outdated
Co-authored-by: Alex Guteniev <gutenev@gmail.com>
@StephanTLavavej

Copy link
Copy Markdown
Member Author

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

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

None yet

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