Compiler memory barrier
These barriers prevent a compiler from reordering instructions, they do not prevent reordering by CPU.
The GNU inline assembler statement- asm volatile("" ::: "memory");
or even- __asm__ __volatile__ ("" ::: "memory");
forbids GCC compiler to reorder read and write commands around it.[5]
学习了.
|