On Tuesday, 21 May 2013 at 17:40:02 UTC, Idan Arye wrote:
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.

OK, I've written and pushed the documentation. I'll try to find somewhere to host the generated HTML.

I've also added `SharedSingleton` and renamed `LowLockSingleton` to `__GSharedSingleton` for consistency. I *did not* rename `ThreadLocalSingleton` to `StaticSingleton` - this will be too confusing("aren't all singletons static?").

Reply via email to