Re:Sayonara, C++, and Hello to Rust
by tialaramex on Tuesday December 07, 2021 @06:29PM
(#29479519)
Unsurprisingly core::sync::atomic is not in fact implemented in Safe Rust.
However you can indeed use it from Safe Rust, and you can choose Orderings which do not give you Sequential Consistency if you're comfortable with that, or more likely because you are implementing an algorithm whose authors assure you this is fine (I hope they're correct). I think that's a very modest caveat to the overall promise of Sequential Consistency, but sure, it is a caveat. If you write code that explicitly asks for Ordering::Relaxed and are astonished you don't get Ordering::SeqCst I guess I apologise for confusing you.
I don't think this is correct. Safe Rust includes atomics that are data-race free but need not be sequentially consistent.