This MSDN article stated that:
processors are free to reorder this code
internal static volatile int s_x = 0;
internal static volatile int s_y = 0;
internal static volatile int s_ya = 0;
void ThreadA() {
s_x = 1;
s_ya = s_y;
}
I am worried if any code could be reordered, and I know how to identify reorderable code. Specially about this piece of my code:
Processing.Add(ItemNumber, null);
AsyncTask.Begin(InternalRequestCallback, Remove, ItemNumber);
It must occur in the specified order or else it fails. Should I put a Thread.MemoryBarrier(); between those statements?