4 ms·
It sounds like std::atomic_ref<T>::{load,store}(relaxed) to me. 1. ad-hoc atomicity with ref 2. no ordering https://godbolt.org/z/4h893P7hG https://godbolt.org
by deschutes 8mo ago
It sounds like std::atomic_ref<T>::{load,store}(relaxed) to me.
1. ad-hoc atomicity with ref
2. no ordering
https://godbolt.org/z/4h893P7hG https://godbolt.org/z/4h893P7hG
- bjackman 8mo agoI believe that lets the compiler reorder the accesses. So this would be fine for my second example but it would be broken for my first example. ({READ,WRITE}_ONCE() only lets the compiler reorder the accesses if they happen in the same C statement). I think C++ doesn't have an equivalent because it just doesn't make sense as a primitive in very many environments.