This is the mail archive of the guile@cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Weak observers (was Re: The taming of the before-gc-hook)


Jost Boekemeier <jostobfe@calvados.zrz.TU-Berlin.DE> writes:

> That's exactly what I did yesterday.  The container object is a smob
> (an environment) and the observer objects that belong to the container
> are smobs, too(*).  Now if the container smob (if it's not a smob,
> just wrap a smob around your data) is no longer referenced its free()
> method is called and it can invalidate the common resource and the
> back-pointer to itself that the observer objects observing this
> environment use to access the common resource.  Once the environment
> is gone its observers will be collected unless someone still
> references it.  But then the observer detects that its container (the
> environment) is gone and does nothing.

Ah, you need it for the module system?

Then it is probably highly time critical code.

Could you describe the problem (or maybe forward pieces of Jim's and
your discussion to me)?  What exactly is a weak observer?  In what
situations is the container freed?

It sounds expensive to iterate over the observers when the container
is freed.  It should probably be avoided.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]