On Sat, 3 Apr 2004, [gb2312] Lei Jin wrote:
Use "ccc chain" mechanism makes the code seeming uniform. But it cause the source code difficult to understand because lots of indirect function call and variety of parameters.
The other way is to use threads and mutexes (much more complex and a bit slower too).
I wonder whether we can call the target function directly instead of using "ccc chain", but I do not know if there is difference between these two methods ???
The CCC is not just a way of making function calls, is a theory that allows for implementing non-preemptive parallelism without threads or forks. All the networking and error control in Dillo is driven by these pseudo-threads each shaped as a dynamic CCC. There can be even hundreds of them running at the same time (depending on the page, and on how many pages are loading in the background). Each thread doing network jobs can linger for a long time (generally measured in seconds, depending on latency, network load, size of the transfer, bandwidth etc) --that explains the need for a parallel approach--, now, each one of those threads needs independent error control and recovery, and it may have several steps to perform, so it also has to keep track of its state. That's the job of the CCC. It looks like contrived complexity, for sure, but that's mainly because people don't even start to realize that it handles parallelism in a single address space. This is a bit of my fault, I created the theory while working on Dillo, but I've never had the time to write it down and present it in abstract. Priorities always stood in the way. To my relief, it has worked rock solid, flexible enough to even account for plugins, and has needed low maintenance. Beleieve it or not, when things arrive to this state, the Jargon file regards them as "Deep magic". Cheers Jorge.-