Skip to content

Details missing around std::sync::atomic and their orderings #52608

Closed
@vorner

Description

@vorner

The atomic orderings are something that would be really useful to have the exact details documented, as one might want to go as far as to write proofs about what orderings are safe to use, if any at all.

To be more specific, I'm missing these two pieces now:

  • SeqCst says it acts like AcqRel with additionally anchoring the operation on a global timeline. However, AcqRel on load is effectively only Acquire (I guess because without store, other threads can't know when that load effectively happened). Does that apply to SeqCst on load as well that operations can be moved after it?
  • Is compare_and_swap considered an operation that combines load and store even in case it fails, or is it only a load (and therefore turns AcqRel into Acquire only)?

I'd be happy to update the documentation, but I don't know what guarantees are actually provided.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions