Re: Squid-2.6 merge fest, cbdata

From: Henrik Nordstrom <>
Date: Fri, 5 Apr 2002 19:41:02 +0200

I will merge the improved cbdata interface during end of next week unless
there is someone having an objection to this.

Warning: this is a major change of the cbdata API to make it more robust and
easier to use for it's intended scope. Because of this it may have conflicts
with some other developments. See the revised programmers guide for details.

The new API uses more atomic operations, mainly replacing the
cbdataLock()/cbdataUnlock() pairs with new approaches to cbdata reference
management.. Any code using cbdataLock()/cbdataUnlock() will need to be
revised to use the new API. (the manual lock/unlock is still provided as
undocumented functions, but will eventually be dropped entirely)

Typical usage is shown in the examples section in the revised cbdata
programmers guide.

In most cases this is a change from

   mystate->some_cbdata_pointer = pointer;

   if (cbdataValid(mystate->some_cbdata_pointer))
        do the callback...


   mystate->some_cbdata_pointer = cbdataReference(pointer);

   if (cbdataReferenceValid(mystate->some_cbdata_pointer))
        do the callback...

Other alternatives are possible. See the docs.

It is also planned to make a small change in NULL semantics. Currently a NULL
cbdata pointer was always considered valid, but I'd like to see it considered
as invalid to ensure that a reference destroyed by cbdataReferenceDone() is
considered invalid. This change won't be done now however. First need to
review the existing cbdata use a second time to see if there is any code
using NULL cbdata pointers..

Received on Fri Apr 05 2002 - 10:41:06 MST

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:14:58 MST