[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: The order of objects returned from a guardian

From: Marius Vollmer
Subject: Re: The order of objects returned from a guardian
Date: Sun, 31 Jul 2005 22:31:18 +0300
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

Neil Jerram <address@hidden> writes:

>> If you do, you would need to take care of the ordering yourself, which
>> is quite easy by keeping objects alive in a global data structure
>> until they are no longer needed.
> Not sure what you mean by this, though.  How would this generate an
> ordering?

Say you need BAR during the finalization of FOO.  In order to ensure
that BAR is not itself finalized before FOO is, you can keep BAR
accessible by putting it into a global data structure.  As long as BAR
is accessible, it will not be returend by a guardian.  When you have
finalized FOO, you can remove BAR from that data structure.

(I am a bit worried right now that the 'obvious' approach of putting
FOO and BAR into a weak key hashtable with FOO as the key and BAR as
the value does conflict a bit with my original goal of breaking up
cycles from strong values to weak keys.  With the code that I have
now, both FOO and BAR are not considered accessible just by virtue of
being in the hashtable.  Thus, once FOO is considered inaccessible,
BAR might be inaccessible as well; both could be returned from
guardians in any order.  Hmm.)

GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3  331E FAF8 226A D5D4 E405

reply via email to

[Prev in Thread] Current Thread [Next in Thread]