8.3.1 _MemoryBarrier Macro

Implements a read/write memory barrier.

Include

<avr/cpufunc.h>

Prototype

void _MemoryBarrier(void);

Remarks

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.

Example

#include <avr/cpufunc.h>
int main(void)
{
  data = readMode();
  _MemoryBarrier();
  processData(&data);
}