Re: ref counting in Bonobo








I have a suggestion, then.  Admittedly, it would be difficult to design a
good mechanism to handle clients dying.  But allowing clients to
directly call the Unknown::ref and Unknown::unref requests on the remote
object makes it difficult to replace the lifetime management mechanism
later.

Instead, insulate clients from the actual details of ref counting by provide
ref and unref library functions.  Currently, they can be implemented as
calls the object's ref and unref methods, but in the future, Gnome could
transparently replace the mechanism in a future release.

Here's an example of an alternative mechanism you could support in this
way:  Servers support an interface that's internal to Bonobo that allows
clients to register a ping interface with them.  When the client obtains
the initial reference it registers a ping interface (this would have to be
handled by the mechanism that hands initial references to the client).
When the client's reference count reaches zero, it unregisters the ping
interface.  On the server side, each time a client registers a ping
interface with the server, the server uses the object's Unknown interface
to increase the ref count on the object.  It decreases the ref count
whenever a client unregisters the ping interface, or whenever the client
fails to respond to an actual ping attempt after a certain amount of time.
All of this server-side work should be wrapped in library routines as
well, so that it is transparent to the server implementation.

It's easy to imagine many other possible mechanisms that would support
servers discovering if they have a dangling reference.  Probably only
experience would dictate which mechanism is suitable for Gnome.  By hiding
the actual mechanism from clients and servers, you gain the flexibility to
experiment with different lifetime management techniques.

Walt

On Tue, 28 Sep 1999, Miguel de Icaza wrote:

>
> > Do Bonobo client programs explicitly call ref and unref on server objects,
> > or is this all handled transparently by Gnome?
>
> explicitly (if you count QI as explicit too :-)
>
> mimguel.
>





--
        FAQ: Frequently-Asked Questions at http://www.gnome.org/gnomefaq
         To unsubscribe: mail gnome-components-list-request@gnome.org with
                       "unsubscribe" as the Subject.




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