GC, the simple solution

Daniel Keep 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?
> L. 

*slaps forehead*

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

	-- Daniel

Unlike Knuth, I have neither proven or tried the above; it may not even
make sense.

i28a2Xs3MSr2e4/6+7t4TNSMb6HTOp5en5g6RAHCP  http://hackerkey.com/

More information about the Digitalmars-d mailing list