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

Add a weakCompareExchange taking only one ordering #75

Closed
lorentey opened this issue Mar 20, 2023 · 0 comments · Fixed by #76
Closed

Add a weakCompareExchange taking only one ordering #75

lorentey opened this issue Mar 20, 2023 · 0 comments · Fixed by #76
Labels
enhancement New feature or request
Milestone

Comments

@lorentey
Copy link
Member

I omitted this because I didn't expect it would be needed, but I've found myself reaching for it surprisingly often over the years.

protocol AtomicStorage {
  ...
  @_semantics("atomics.requires_constant_orderings")
  static func atomicWeakCompareExchange(
    expected: Value,
    desired: __owned Value,
    at pointer: UnsafeMutablePointer<Self>,
    ordering: AtomicUpdateOrdering
  ) -> (exchanged: Bool, original: Value)
}

This can ~trivially forward to the existing requirement by default, but we'll want actual implementations anyway.

@lorentey lorentey added the enhancement New feature or request label Mar 20, 2023
@lorentey lorentey added this to the 1.1.0 milestone Mar 20, 2023
lorentey added a commit to lorentey/swift-atomics that referenced this issue Mar 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant