On Tuesday, 21 May 2013 at 14:58:16 UTC, Idan Arye wrote:
At any rate, I am forced to admit I made a mistake about
`hasIntance()` not needing synchronization. I neglected the
possibility that the constructor(or anything else used for
initialization) can throw!
The compiler might decide that it's better to write the global
reference first, and if the initializer throws just set it back
to null. If that is the case, `hasInstance()` could see that
the global reference is not null and return true, and then the
initializer will throw and the initializing thread will set the
global reference to null again.
So yea, I'm gonna have to synchronize it too...
OK, it is done.
Next step - write the introduction. And then add the shared
version of the singleton.