[prog] my ccoro library

Sam Watkins sam at nipl.net
Tue Jun 2 01:02:59 UTC 2009


I wrote a coroutine library in plain C last night.
It uses setjmp and longjmp, and allocates empty space on the stack to
separate the coroutines so each can use its own piece of stack safely.

http://sam.nipl.net/ccoro.c

I'm pretty happy with it, and I thought you might be interested.

Not sure if this is like a well-known elementary technique or if it's
actually innovative!  but I haven't seen such a simple technique for
coroutines in C before.

thanks,

Sam



More information about the Programming mailing list