Hard
Two seq_cst store/load pairs across two threads
x and y start at 0. threadA and threadB run concurrently as shown, then the program joins both and prints r1 and r2. Which outcome is impossible?
main.cpp
std::atomic<int> x{0}, y{0};
int r1, r2;
void threadA() {
x.store(1, std::memory_order_seq_cst);
r1 = y.load(std::memory_order_seq_cst);
}
void threadB() {
y.store(1, std::memory_order_seq_cst);
r2 = x.load(std::memory_order_seq_cst);
}3 of 51 in Concurrency