Suppose A
, B
, a
, and b
are all variables, and the addresses of A
, B
, a
, and
My read is that this is required to work by the C++ standard; however if you're trying to use this for multithreading control, it doesn't work in that context because there is nothing here to guarantee the registers get written to memory in the right order.
As your edit indicates, you are trying to use it exactly where it will not work.