At start a
and b
are 0
- In thread 1,atomic write
a=1
then atomic readb
- In thread 2,atomic write
b=1
then 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 b
b=1
then atomic read a
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?