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

finalization and smalltalk weak pointers



I figured out a generalization of the trick used for the SnarfPacker
to handle finalization consistently between Smalltalk and C++.  

This trick restricts finalization to no-argument messages (which I
will call release messages) sent to objects that care about the
existence of the dying object.  Essentially, every object that will
receive such a message from a dying object has a smalltalk
weak-pointer to that object.  When the object goes away, the weak
pointer will send an update message to the receiving object (smalltalk
only).  This update message will in turn send the appropriate release
message that in C++ would be sent by the dying object.  Let me further
require that the release method not use any pointers to the dying
object.

Any object with more than one such weak pointer can have a single
weeak collection.  

I haven't quite generalized the token trick in SnarfPAcker for
tracking a weak collection of objects....

dean