an extremely naive question regarding synchronized...
Kagamin via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Nov 16 02:50:28 PST 2016
static MySingleton get() {
if (instance_ is null) {
synchronized {
if (instance_ is null) {
atomicStore(instance_, new MySingleton);
}
}
}
return instance_;
}
This should work fine and faster.
More information about the Digitalmars-d-learn
mailing list