2

It seems Release-Acquire ordering is enough in most cases, so is there any real-life examples where you can only use memory_order_seq_cst?(and Ordering::SeqCst, because rust shares same memory order with C++)

I've searched some common multi thread data structures, and none of them using memory_order_seq_cst.

1
  • 2
    Maybe it exists only for convenience (it's the default argument for C++ atomics). The guaranties are so strong that it's easy to do some reasoning about the concurrent accesses. If someone wants to try something quickly with some atomics, without bothering too much about memory ordering, there cannot happen too many inconsistencies due to memory-ordering.
    – prog-fh
    Commented May 18, 2024 at 16:24

1 Answer 1

0

I found an usage of memory_order_seq_cst here in an work stealing queue implement, where you must use seqcst order to make every thead saw same update order between top and bottom.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.