Does a volatile Double
have cross-thread visibility the way volatile double
has?
From the Java Tutorials at Oracle is the following:
Using volatile variables reduces the risk of memory consistency errors, because any write to a volatile variable establishes a happens-before relationship with subsequent reads of that same variable. This means that changes to a volatile variable are always visible to other threads. What's more, it also means that when a thread reads a volatile variable, it sees not just the latest change to the volatile, but also the side effects of the code that led up the change.
It would seem to depend upon whether a Double is a special kind of object or an object that has nothing special about it.