Protothreads r0 (See the current copy)
Simple ANSI C implementation of Cooperative Threading.
One of the major limitations of Protothreads is that the PT functions can only be called from one translation unit and in a direct call chain.
You can't, for example, create a Tcl interface to Protothreads since that would require calling PT_YIELD outside of a direct call chain.
My "Yield Term" patch against Protothreads. In stock Protothreads if you PT_EXIT from a Protothread and you request that it be scheduled again then it starts all over again from the beginning. This patch marks a thread as exited when it calls PT_EXIT so that PT_SCHEDULE has no effect on it (until PT_INIT is called on it).
Sample application using Protothreads:
- http://www.rkeene.org/projects/info/resources/threads/test1-pt.c
- http://www.rkeene.org/projects/info/resources/threads/test2-pt.c