[clug] coroutines in C

Andreas Bauer baueran at t-online.de
Wed Jul 9 21:42:52 EST 2003


On Wed, Jul 09, 2003 at 12:31:49PM +1000, Martin Pool wrote:
> re the earlier thread:
> 
>   http://www.chiark.greenend.org.uk/~sgtatham/coroutines.html
> 
> Something along those lines is probably the best way to do it.  Data
> processing libraries ought to be written this way -- zlib, libbz2 and
> librsync are.

Note, however, that optimised tail calls are pretty close to the original
idea of co-routines.  In other words, you can jump back and forth between
routines without having to go through the overhead of an ordinary call
sequence.  I have worked long on this problem and GCC (3.4) does a pretty
good job now in optimising tail calls; even indirect ones on ix86
platforms.

Andi.

-- 
(o_  Andreas Bauer, baueran at in.tum.de, http://home.in.tum.de/baueran/
//\  "The inside of a computer is as dumb as hell but it goes like
V_/_  mad!" -- Richard Feynman



More information about the linux mailing list