As known in since C++11 there are 6 memory orders, and in documentation written about std::memory_order_acquire
:
The reference you cited is pretty clear: you can't move reads before this load. In your example:
static std::atomic X;
static int L;
void thread_func()
{
int local1 = L; // (1)
int x_local = X.load(std::memory_order_acquire); // (2)
int local2 = L; // (3)
}
memory_order_acquire
means that (3) cannot happen before (2) (the load in (2) is sequenced before thr load in (3)). It says nothing about the relationship between (1) and (2).