_ReadWriteBarrier, _WriteBarrier, _ReadBarrier

9/7/2007

_ReadWriteBarrier forces all previous memory accesses to complete before subsequent memory access is started.

_WriteBarrier forces all previous memory write operations to complete before any subsequent write operation is started.

_ReadBarrier forces all previous memory read operations to complete before any subsequent read operation is started.

Syntax

void __cdecl _ReadWriteBarrier(void);
void __cdecl _WriteBarrier(void);
void __cdecl _ReadBarrier(void);

Parameters

None.

Return Value

None.

Remarks

_WriteBarrier is usually used for writing device drivers to make sure that a set of commands has been sent to the device before further commands are issued. The compiler does not reschedule memory writes across an invocation of _WriteBarrier, even on hardware platforms without explicit synchronization instructions.

_ReadWriteBarrier is usually used for writing device drivers to make sure that commands have been sent to the device before status is read.

The compiler does not reschedule memory reads and writes across an invocation of _ReadWriteBarrier, even on hardware platforms without explicit synchronization instructions.

_ReadBarrier forces reads from memory to complete at the point of the call. After the call, other threads can access the memory without fear that the thread that made the call might have a pending read from the memory.

Requirements

Routine Required header Architecture

_WriteBarrier

<cmnintrin.h>

x86, ARM, SH-4, MIPS

_ReadWriteBarrier

<cmnintrin.h>

x86, ARM, SH-4, MIPS

_ReadBarrier

<cmnintrin.h>

x86, ARM, SH-4, MIPS

See Also

Other Resources

Intrinsic Functions for Device Compilers