What does the JMM guarantee about a thread's actions before it starts another thread, and what does it guarantee when a thread join()s a finished thread?
// main:
shared = 1;
Thread t = new Thread(r);
t.start(); // (A)
// ... t reads shared, sets result
t.join(); // (B)
int x = result;