Low-Lock Singletons In D

Sergei Nosov sergei.nosov at gmail.com
Mon May 6 02:30:22 PDT 2013


On Monday, 6 May 2013 at 09:11:00 UTC, Mehrdad wrote:
> On Monday, 6 May 2013 at 09:06:55 UTC, Mehrdad wrote:
>> lock (this)
>> {
>> 	_static = new ActualValue<T>();
>> }
>
> Oops I forgot the null check inside, don't forget that.

All that double-checking stuff is trying to avoid calling "lock" 
for entire Get function body. Your solution does exactly that. So 
it's no good.


More information about the Digitalmars-d mailing list