This is the mail archive of the
guile@cygnus.com
mailing list for the Guile project.
Weak observers (was Re: The taming of the before-gc-hook)
- To: Jost Boekemeier <jostobfe@calvados.zrz.TU-Berlin.DE>
- Subject: Weak observers (was Re: The taming of the before-gc-hook)
- From: Mikael Djurfeldt <mdj@mdj-pc.nada.kth.se>
- Date: 28 Jul 1999 17:18:34 +0200
- Cc: Jim Blandy <jimb@red-bean.com>, Greg Harvey <Greg.Harvey@thezone.net>, guile@cygnus.com
- Cc: djurfeldt@nada.kth.se
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.