Coroutines in C, Duff's device and Protothreads

All this craziness was started with Duff’s device:

Continued with Simon Tatham’s Coroutines in C hack:

PuTTY is a Win32 Telnet and SSH client. The SSH protocol code contains real-life use of this coroutine trick. As far as I know, this is the worst piece of C hackery ever seen in serious production code.

Finally, this trick was used by Adam Dunkels in a real operating system for embedded devices:

611 views and 0 responses