Пример #1
0
 public static void Write(ref float location, float value)
 {
     //
     // The VM will replace this with a more efficient implementation.
     //
     Interlocked.MemoryBarrier();
     location = value;
 }
Пример #2
0
 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;
 }
Пример #3
0
        public static int Read(ref int location)
        {
            //
            // The VM will replace this with a more efficient implementation.
            //
            var value = location;

            Interlocked.MemoryBarrier();
            return(value);
        }
Пример #4
0
        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);
        }
Пример #5
0
 public static void MemoryBarrier() => Interlocked.MemoryBarrier();