I have read that code inside a synchronized block conform to 'happens before' semantics so that all the values written inside a synchronized block should be visible to other threads in succession. Furthermore I have read that caches are only flushed with the termination of synchronized block. How would above semantic of 'happens before' be enforced in the scenario described below if only caches are flushed with the synchronized block termination?
Thread A has a reference to object C and changes a field of C in its synchronized code synchronized on C. Thread B also has got a reference to object C. Now thread A is suspended before the synchronized code is finished. Thread B jumps in to action and access object C's field in code with no synchronization on C.
Now is thread B guaranteed to see the changes made by Thread A?