Protothreads and Other Wicked C Tricks 229
lwb writes "For those of you interested in interesting hard-core C programming
tricks: Adam Dunkels' protothreads library
implements an unusually lightweight type of threads. Protothreads are
not real threads, but rather something in between an event-driven
state machine and regular threads. But they are implemented in 100%
portable ANSI C and with an interesting but quite unintuitive use of the switch/case
construct. The same trick has previously been used by Simon Tatham to implement
coroutines
in C. The trick was originally invented by Tom Duff and dubbed Duff's
device. You either love it or you hate it!"
Job security? (Score:4, Funny)
Sounds ideal!
Seen this already (Score:5, Funny)
Re:Wait just a minute ... (Score:4, Funny)
Re:From the source: (Score:5, Funny)
When I saw that code snippet, I found myself switching back and forth between thinking "this is the most beautiful thing I have ever seen" and "dear god, who ordered that monster" so rapidly my brain almost a sploded.
Re:Dijkstra says... (Score:4, Funny)
Actually, since the running of $export DEITY=Dijkstra, he is now.
Re:extremely limited applicability (Score:3, Funny)
Yeah, but my brain -- Ooh! Shiny!