At start a and b are 0
- In thread 1,atomic write
a=1then atomic readb - In thread 2,atomic write
b=1then atomic reada
If I want to make sure thread 1 can read b=1 or thread 2 can read a=1,which memory order should I use,and why?
At start a and b are 0
a=1 then atomic read bb=1 then atomic read aIf I want to make sure thread 1 can read b=1 or thread 2 can read a=1,which memory order should I use,and why?