This prevents reordering (auto compiler optimizations), or, ensures memory operations become visible in the right order.
mfence: All loads and stores before the barrier become visible before any loads and stores after the barrier become visible.sfence: All stores before the barrier become visible before all the stores after the barrier becomes visible.lfence: All loads before the barrier become visible before all loads after the barrier becomes visible. These are costly in performance.