Hi.
Thanks, this is really useful information. I read the spec you linked above: https://en.m.wikipedia.org/wiki/Java_memory_model
From what I can make of it the possible reordering of processes at compilation is computed based on happens-before order. I think I get this, but presumably there is no way to really work out what the order is between threads.
In which case - is the advice always to mark a variable as volatile if it is used by multiple threads? Or at least if their completion requires that a thread may have a specific value?
Thanks