I think C++ does not cover any sort of transaction memory yet, but still TSX can somehow fit using "as if rule" into something that is governed by C++ memory model.
So, what happens on successful HLE operation, or successful RTM transaction?
Saying "there is data race, but it is ok" is not much helpful, as it does not clarify what "ok" means.
With HLE probably it can be seen as "previous operation happens before subsequent operation. As if the section was still guarded by the lock that was elided".
What is with RTM? As there's no even an elided lock, only (potentially non-atomic) memory operations, which could be loads, stores, both, or no-op. What is synchronized with what? What happens before what?
std::call_once
, that is called from a single thread most of the time, so is likely to benefit from lock elided by HLE (sure, transition between states is under potentially elided lock, not user callback). Or maybe evenshared_ptr
copy counters, that mostly copied in a single thread. – Videogenic