BARRIER(3)

NAME
OSMemoryBarrier - memory barrier to order loads and stores

LIBRARY
libc

SYNOPSIS
#include <libkern/OSAtomic.h>
void
OSMemoryBarrier(void);

DESCRIPTION
OSMemoryBarrier() strictly orders memory accesses in a weakly ordered memory model such as with ARM, by creating a barrier. All loads and stores executed in sequential program order before the barrier will complete with respect to the memory coherence mechanism, before any load or store executed after the barrier. Used with an atomic operation, the barrier can be used to create custom synchronization protocols as an alternative to the spinlock or queue/dequeue operations. Note that this barrier does not order uncached loads and stores. On a uniprocessor, the barrier operation is typically optimized into a no-op.

SEE ALSO
atomic(3), spinlock(3)