Export (0) Print
Expand All
Expand Minimize
This topic has not yet been rated - Rate this topic

_ReadBarrier

Microsoft Specific

Forces reads from memory to complete at the point of the call.

Caution noteCaution

The _ReadBarrier, _WriteBarrier, and _ReadWriteBarrier compiler intrinsics prevent only compiler re-ordering. To prevent the CPU from re-ordering read and write operations, use the MemoryBarrier macro.

void _ReadBarrier(void);

Intrinsic

Architecture

_ReadBarrier

x86, IPF, x64

Header file <intrin.h>

The _ReadBarrier, _WriteBarrier, and _ReadWriteBarrier functions help ensure the proper operation of multithreaded programs that are optimized by the Visual C++ compiler. A correctly optimized program yields the same results when it executes on multiple threads as when it executes on a single thread. 

To help ensure that the optimized program operates correctly, the _ReadBarrier function 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. For more information, see the remarks in _ReadWriteBarrier.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.