Interlocked.MemoryBarrier Method ()

.NET Framework (current version)

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.

Universal Windows Platform
Available since 8
.NET Framework
Available since 4.5
Portable Class Library
Supported in: portable .NET platforms
Windows Phone Silverlight
Available since 8.0
Windows Phone
Available since 8.1
Return to top