Slashdot Mirror


Protothreads and Other Wicked C Tricks

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!"

6 of 229 comments (clear)

  1. it.slashdot.org? by bit+trollent · · Score: -1, Offtopic

    more like developers.slashdot.org

    amicorrect?

  2. Wait just a minute ... by Anonymous Coward · · Score: 0, Offtopic

    1) Your operating system in written in Java.
    2) Your email client in written in Java.
    3) Your browser is written in Java.
    4) Your music player is written in Java.
    5) Perl in written in Java.
    6) Your word processer is written in Java.

    So there !!! Java rules !!!

    1. Re:Wait just a minute ... by Anonymous Coward · · Score: -1, Offtopic

      I'm glad to see that you realized the 's' key is not next to the 'n' key and that is != in.

  3. failzOrs by Anonymous Coward · · Score: -1, Offtopic
  4. C Language Protothread Benefits by Anonymous Coward · · Score: -1, Offtopic

    I know !!! Let's talk politics
    on Slashdot !!!!!

    Because we all know dorks
    incapable of washing themselves
    on a regular basis are really
    in a position to deliver insightly
    and relevant political commentary.

                                      Capitalism Sucks !!!!!!!!!!!!!!!!!
                                      As I type this on a computer which
                                      capitalism made possible.

  5. Re:From the source: by Anonymous Coward · · Score: -1, Offtopic

    ...my brain almost a sploded.

    Looks like it already has: brain almost exploded.