11/10/19 08:42:15.18
メモリバリアとか難しすぎて頭おかしくなりそう
atomic_int a = 0, b = 0;
//thread1
a.store_acquire(1);
int x = b.load_release();
//thread2
b.store_acquire(1);
int y = a.load_release();
これでx == 0 && y == 0が真になることがあるという話なんだけど頭の中でどう考えてもならない
いったいどういうカラクリでx,yが同時に0になるの?