I have see this :
Pattern #2: one-time safe publication
The visibility failures that
are possible in the absence of synchronization can get even trickier
to reason about when writing to object references instead of primitive
values. In the absence of synchronization, it is possible to see an
up-to-date value for an object reference that was written by another
thread and still see stale values for that object's state. (This
hazard is the root of the problem with the infamous
double-checked-locking idiom, where an object reference is read
without synchronization, and the risk is that you could see an
up-to-date reference but still observe a partially constructed object
through that reference.)*
from IBMdeveloperworks_volatile
I am confused :
- what is 'primitive values'
- Why it cause : 'to see an up-to-date value for an object reference that was written by another thread and still see stale values for that object's state'