On Friday, 11 March 2016 at 15:21:38 UTC, maik klein wrote:
static Singleton!T get()
{
if (!instantiated_)
{
synchronized(Singleton!T.classinfo){
if (!instance_){
instance_ = new Singleton!T();
}
instantiated_ = true;
instance_.tls.insertBack(&instance_.value);
As a drive-by comment, mind that there is a race there. _instantiated may have been set after the if statement but before the synchronized block. You have to test it again inside.
