Skip to content

All atomic operations use the default memory_order_seq_cstΒ #6

@JBontes

Description

@JBontes

Your atomic operations all use the sequentially-consistent ordering. This imposes a hard barrier on all atomic operations. For loads this can be more efficiently replaced with a memory_order_acquire and for stores this should be replaced with memory_order_release. On load/stores (aka CAS operations) you can do: memory_order_acq_rel for success and memory_order_relaxed for failure.
If you happen to have a store after the CAS, you can downgrade the success order to memory_order_acquire.

See: https://en.cppreference.com/w/cpp/atomic/memory_order

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions