Alex Rousskov wrote:
> Ah, yes. I forgot about this asymmetry. Not sure it is the best design
> (a simple refcounted pointer with an "invalidate" method seems more
> natural/general to me), but you certainly know better what Squid code
> needs.
cbdata is implemented for a specific purpose, callback function
arguments, to allow the original "caller" to know it's state in the
callback in a safe manner.
Normally, only the one creating the object should access it. The others
only store a reference on behalf of the owner, to be passed back to the
owner in the event of a callback. Only the owner are allowed to
invalidate the object, as only the owner has access to the object.
For this the current design works very well.
Having reference counted objects with a invalidate method would make the
above more complex than needed and also broadends the allowed/possible
scope of use to much more than only callback data, making the name
unsuitable. To address this there is another type/class under
development by Robert, implementing reference counted objects.
These could be made into two different interfaces to the same
implementation if needed (not too unlikely in the event of a rewrite).
-- HenrikReceived on Fri Jul 13 2001 - 01:32:36 MDT
This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:14:07 MST