I want to add a Phobos module with template mixins for common idioms.

Idan Arye GenericNPC at gmail.com
Tue May 21 07:58:13 PDT 2013


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...


More information about the Digitalmars-d mailing list