I was reading this thread about why double checked locking fails in a multi-processor environment.
http://www.javaworld.com/javaworld/jw-02-2001/jw-0209-toolbox.html?page=4
In the page 3, the author mentions that -
"To summarize, synchronization implies a memory barrier. Consequently, though the code within the synchronized block is subject to reordering, all modifications made within that block will be visible in main memory (for other threads to view) when you exit the synchronized block."
and in page 4 -
"The problem: the assignments that occur within the constructor occur within the same memory barrier as the assignment to the_instance. As a consequence, it's possible for the_instance to be non-null, even though the assignments that occurred in the constructor are yet not visible. If one thread gets as far as the statement the_instance=new Disfunctional_singleton(), and the assignment to the_instance is visible but the assignments within the constructor are not yet visible, then a second thread that calls get_instance() method can return a pointer to an uninitialized object. "
That seems contradictory because once you exit the synchronized block everything should be visible.
Does that mean that a thread can exit by just issuing a call to the constructor even before the construction is complete?
Thanks.