In a multithreaded program, do you ever get any guarantees from memory_order_seq_cst that you wouldn't also get from a weaker ordering, if you only have one thread that uses it? Example:
#include <stdatomic.h>
extern atomic_int x, y;
void doSomething(void);
void thread1(void) {
atomic_store_explicit(&x, 1, memory_order_seq_cst);
atomic_thread_fence(memory_order_seq_cst);
if(atomic_load_explicit(&y, memory_order_seq_cst)) {
doSomething();
}
}
void thread2(void) {
atomic_store_explicit(&y, 1, memory_order_release);
atomic_thread_fence(memory_order_acq_rel);
if(atomic_load_explicit(&x, memory_order_acquire)) {
doSomething();
}
}
If thread1 and thread2 are running in parallel, is it guaranteed that exactly one will always call doSomething?