Low-Lock Singletons In D

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Tue May 7 08:30:12 PDT 2013


On 5/7/13 10:31 AM, Steven Schveighoffer wrote:
> On Tue, 07 May 2013 09:25:36 -0400, Andrei Alexandrescu
> <SeeWebsiteForEmail at erdani.org> wrote:
>
>> No. A tutorial on memory consistency models would be too long to
>> insert here. I don't know of a good online resource, does anyone?
>
> In essence, a read requires an acquire memory barrier, a write requires
> a release memory barrier, but in this case, we only need to be concerned
> if the value we get back is not valid (i.e. NullValue).
>
> Once in steady state, there is no need to acquire (as long as the write
> is atomic, the read value will either be NullValue or ActualValue, not
> something else).

There's always a need to acquire so as to figure whether the steady 
state has been entered.

Andrei


More information about the Digitalmars-d mailing list