GC, the simple solution
daniel.keep.lists at gmail.com
Sun Jun 4 22:52:19 PDT 2006
Lionello Lunesu wrote:
>> They definitely have to be synched: because in decref you've got to:
>> 1. ref--;
>> 2. if( ref == 0 ) free(ptr);
>> 3. if( obj.canHaveCycles ) registerForCycleCheck(obj);
>> If not more. You then also need the incs synched with that, otherwise
>> you could end up "ref++"ing in the middle of "free(ptr)".
> The thread doing the ++ apparently has a pointer to the object without a
> reference. How could that ever happen?
Of course; you're right. I was thinking about race conditions, but
obviously got confused.
Please refer to my signature. Specifically the "it may not even make
sense." part :P
Unlike Knuth, I have neither proven or tried the above; it may not even
More information about the Digitalmars-d