Example #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;
 }
Example #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;
 }
Example #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);
        }
Example #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);
        }
Example #5
0
 public static void MemoryBarrier() => Interlocked.MemoryBarrier();