_MemoryBarrier

_MemoryBarrier()

Implement a read/write memory barrier. A memory barrier instructs the compiler to not cache any memory data in registers beyond the barrier. This can sometimes be more effective than blocking certain optimizations by declaring some object with a volatile qualifier.

See Problems with reordering code for things to be taken into account with respect to compiler optimizations.