c++rustconcurrencymemory-barriersdata-race

Any real-life examples for memory_order_seq_cst?


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.


Solution

  • 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.