Low-Lock Singletons In D

Steven Schveighoffer schveiguy at yahoo.com
Tue May 7 19:52:36 PDT 2013


On Tue, 07 May 2013 18:49:19 -0400, Andrei Alexandrescu  
<SeeWebsiteForEmail at erdani.org> wrote:

> On 5/7/13 6:12 PM, Steven Schveighoffer wrote:
>> So that must not be what it is doing. What it must be doing is storing
>> out of order, BUT placing a prevention mechanism from reading the memory
>> until the "release" is done? Kind of like a minuscule mutex lock. So
>> while it is out-of-order writing the object data, it holds a lock on the
>> reference pointer to that data, so anyone using acquire cannot read it  
>> yet?
>>
>> That actually makes sense to me. Is that the case?
>
> Not at all. A memory barrier dictates operation ordering. It doesn't do  
> interlocking. One of Herb's slides shows very nicely how memory  
> operations can't be moved ahead of an acquire and past a release.

I will have to watch those some time, when I have 3 hours to kill :)

Thanks for sticking with me and not dismissing out of hand.  This is  
actually the first time I felt close to grasping this concept.

-Steve


More information about the Digitalmars-d mailing list