Puzzled at callback data in Squid-2.5.PRE6.

From: <maer727@dont-contact.us>
Date: Fri, 19 Apr 2002 19:19:17 +0800 (CST)

Hi, pals!

I meet trouble when reading CBDATA.c. I read the comment in
front of the source file and still could not make myself
fully understood. I search "callback" in FAQ and squid.conf, but failed.

Here is my trouble. I do not clearly understand the relationship
between cbdata, some_blocking_operation and callback_func.

I have used callback function, it is a function that blocks at a time and
executes when condition is satisfied. IMHO

Like the following below in the comment of CBDATA.c:
 * foo = xcalloc(sizeof(foo));
 * cbdataAdd(foo);
 * ...
 * cbdataLock(foo);
 * some_blocking_operation(..., callback_func, foo);
 * ...
 * some_blocking_operation_completes()
 * if (cbdataValid(foo))
 * callback_func(..., foo)
 * cbdataUnlock(foo);
 * ...
 * cbdataFree(foo);

What is the relationship between cbdata, some_blocking_operation and callback_func? What means cbdataLock and cbdataValid?

Best regards,
George, Ma
Received on Fri Apr 19 2002 - 05:20:02 MDT

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