My question is about order of execution guarantees in C# (and presumably .Net in general). I give Java examples I know something about to compare with.
For Java (from \"
I'm worried that you're even asking this but since you asked.
y = 10;
Thread.MemoryBarrier();
x = 5;
Thread.MemoryBarrier();
a = b + 10;
Thread.MemoryBarrier();
// ...
From msdn
Synchronizes memory access as follows: The processor executing the current thread cannot reorder instructions in such a way that memory accesses prior to the call to MemoryBarrier execute after memory accesses that follow the call to MemoryBarrier.