draft proposal for ref counting in D

Sean Kelly sean at invisibleduck.org
Sun Oct 13 08:15:16 PDT 2013


On Sunday, 13 October 2013 at 07:03:39 UTC, Rainer Schuetze wrote:
>
> According to the "Handbook of Garbage Collection" by Richard 
> Jones eager lock-free reference counting can only be done with 
> a cas2 operation modifying two seperate locations atomically 
> (algorithm 18.2 "Eager reference counting with CompareAndSwap 
> is broken"). This might be the quoted paper: 
> http://scholr.ly/paper/2199608/lock-free-reference-counting
>
> Unfortunately the CAS2 operation does not exist in most 
> processors.

I suppose it's worth noting that Boost (and now standard C++) has 
a shared_ptr that works across threads and the implementation 
I've seen doesn't use a mutex.  In fact, I think the Boost one 
doesn't even use CAS on x86, though it's been quite a few years 
so my memory could be wrong on that last detail.


More information about the Digitalmars-d mailing list