MemoryBarrier Method
Collapse the table of content
Expand the table of content

Interlocked.MemoryBarrier Method

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Synchronizes memory access as follows: The processor that executes the current thread cannot reorder instructions in such a way that memory accesses before the call to MemoryBarrier execute after memory accesses that follow the call to MemoryBarrier.

Namespace:  System.Threading
Assembly:  mscorlib (in mscorlib.dll)

public static void MemoryBarrier()

This method was added to the Interlocked class in the .NET Framework 4.5 as a convenience; it's a wrapper for the Thread.MemoryBarrier method.

MemoryBarrier is required only on multiprocessor systems that have weak memory ordering (for example, a system that employs multiple Intel Itanium processors).

For most purposes, the C# lock statement, the Visual Basic SyncLock statement, or the Monitor class provide easier ways to synchronize data.

Windows Phone OS

Supported in: 8.1, 8.0

Show:
© 2017 Microsoft