Whether or not you have a data race UB depends on whether i.load(std::memory_order::acquire);
(informally) happens after i.store(1, std::memory_order::release);
.
Or, technically speaking, if .load()
happens to "take its value from any side effect in the release sequence headed by [the .store()
]".