public static void Write(ref float location, float value) { // // The VM will replace this with a more efficient implementation. // Interlocked.MemoryBarrier(); location = value; }
public static void Write <T>(ref T location, T value) where T : class { // // The VM will replace this with a more efficient implementation. // Interlocked.MemoryBarrier(); location = value; }
public static int Read(ref int location) { // // The VM will replace this with a more efficient implementation. // var value = location; Interlocked.MemoryBarrier(); return(value); }
public static T Read <T>(ref T location) where T : class { // // The VM will replace this with a more efficient implementation. // var value = location; Interlocked.MemoryBarrier(); return(value); }
public static void MemoryBarrier() => Interlocked.MemoryBarrier();