In principle, the answer is yes. Almost all modern platforms allow at least 32-bit or 64-bit atomic loads / storages, provided that the variables are aligned. (Atomic is used here in the sense that you will not load the "partial" value)
Now itโs not clear in the Qt documentation that their atomization provides this using the base (what they call non-nuclear) load() and store() . 'loadAcquire ()' and especially `fetchAndAddRelaxed (0) 'cost more than you need -' loadAcquire 'is by far the cheapest of these 2.
If I were you, I would just use load () and store (). If you need an extra guarantee for Qt documentation, loadAcquire is the cheapest way, and in an architecture like x86, like load ().
The best way is to use the C ++ 11 atom with the laid-back memory model you need.
source share