G+: Simon Tatham, the author of PuTTY, has a …

David Coles
Simon Tatham, the author of PuTTY, has a nice walk through how you could implement Coroutines in C and more importantly why you might want to do that.

In the SUSv3 there's the "makecontext" family of functions (http://pubs.opengroup.org/onlinepubs/009695399/functions/makecontext.html) which are a portable way of saving a function context (without resorting to platform specific assembly) but it's depreciated and been removed from SUSv4. You probably want to use something like Portable Coroutine Library instead (http://xmailserver.org/libpcl.html).

Coroutines in C


(+1's) 1