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.

Reply via email to