Low-Lock Singletons In D
Mehrdad
wfunction at hotmail.com
Mon May 6 11:23:50 PDT 2013
On Monday, 6 May 2013 at 11:21:37 UTC, Dmitry Olshansky wrote:
> Yes, but the 1st processor may read _static exactly when the
> 2nd is inside the lock and writing to that field. Then chances
> are it will read whatever partial state there is written.
> Surely it can. 1st processor takes the lock and write while the
> second one reads static_ to call Get.
It's a single pointer, there is no partial state -- it's either
written or it isn't.
> One way is to ensure write is atomic w.r.t. that particular
> read operation
Are't pointer writes always atomic?
> The neat stuff about that TLS pattern was that you need not to
> rely on hardware specific support.
Ah okay I see, didn't realize that.
More information about the Digitalmars-d
mailing list