draft proposal for ref counting in D

deadalnix deadalnix at gmail.com
Sun Oct 13 02:19:01 PDT 2013


On Sunday, 13 October 2013 at 07:03:39 UTC, Rainer Schuetze wrote:
> How do you increment the counter without reading its address?
>

I assumed that the reference count was in a struct with the data, 
and refcounted point to it.

In this case, if you remove the pointer via a sequencially 
consistent write (while keeping a local copy internally) and THEN 
decrement the counter, the other thread will access another 
object (or skip on a null check). Granted the read is 
sequencially consistent.


More information about the Digitalmars-d mailing list