May 11, 2013

Coroutines in C (bookmarks)

I downloaded Contiki for educational purposes, and first thing which got me trapped are protothreads. I have never read anything about coroutines (yes, blame on me not to read Donald Knuth's books - I'll get to those once I empty my bookshelf). 

Coroutines in C []
Excellent article to the point, with examples and explanations.

Coroutines in less than 20 lines of standard C []
Tony Finch's coroutines which uses setjmp and longjmp for saving the state and jumping to new coroutine.

Protothreads []
Main page for protothreads, if any questions, answer is there probably. Check examples there, or directly contiki implementation.