public static void MemoryBarrier()
        {
#if NET40
            Thread.MemoryBarrier();
#else
            Interlocked.MemoryBarrier();
#endif
        }