Low-Lock Singletons In D

Steven Schveighoffer schveiguy at yahoo.com
Mon May 6 11:08:01 PDT 2013


On Mon, 06 May 2013 13:58:19 -0400, Walter Bright  
<newshound2 at digitalmars.com> wrote:

> On 5/6/2013 6:14 AM, Max Samukha wrote:
>> FWIW, I played with a generalized form of this pattern long ago,  
>> something like
>> (typing from memory):
>
> And, that's the classic double checked locking bug!
>

I think that's exactly what David had in his slide (well, except for an  
obvious typo).

He's only checking t once, and protecting the lock/check with a TLS  
boolean.  Although the set of the boolean is missing (probably a memory  
error, since he typed it from memory :)

-Steve


More information about the Digitalmars-d mailing list