maer727@sohu.com wrote:
> I think in normal implementions of callback, the problem "caller
> freed it's data while callback is pending" is not considered, but Squid
> considered the problem. Am I correct?
Normally it is considered and specified "caller MUST NOT free the
specified callback argument before the callback has completed", which
easily can cause a serious instability in complex tasks where such
criteria can be hard to follow..
A single small error where a registered callback is forgotten can in
such design have catastropic results, and is a nightmare to debug
without a good malloc debugger.. So in Squid we say that freeing the
specified callback argument while the callback is pending is a very
likely thing to happen in a complex statemachine web like Squid and the
code must be able to deal with this without risking corruption.
Therefore the use of the cbdata mechanism.
Regards
Henrik
Received on Wed Apr 24 2002 - 14:02:40 MDT
This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:15:19 MST