Projects / Cheap Threads

Cheap Threads

Cheap Threads is a collection of portable C routines for implementing sychronous threads. It includes a scheduler and a facility for passing messages among threads. Threads may run in a round robin or according to a priority scheme. Each thread must voluntarily relinquish control from time so that other threads can run. Since the threads are synchronous, i.e. they don't interrupt each other, they don't need to use semaphores, mutexes, critical sections, or other facilities to keep from interfering with each other. One version of Cheap Threads is designed for embedded systems.

Operating Systems

Recent releases

  •  17 May 2005 06:33

    Release Notes: This release adds an optional ct_return() function by which a thread may return control to the scheduler by a setjmp/longjmp mechanism rather than by an ordinary function return. In some circumstances, ct_return() may be more efficient or more convenient. By default, ct_return() is disabled in order to avoid overhead for applications that don't use it, but you can enable it by using a compile-time macro.

    •  08 Sep 2003 11:03

      Release Notes: The Cheap Threads functions can now be called directly from C++ programs. A new sample program, demo1, was included to demonstrate two threads that take turns writing to standard output.

      •  28 Jul 2003 12:28

        Release Notes: A memory leak, which was introduced in v2.5, is now fixed. The leak occurred when activating a thread with an enqueue instead of a message.

        •  11 Jun 2003 01:34

          Release Notes: The message-passing machinery now uses a reference-counting scheme to reduce the overhead of delivering messages. This change also reduces the use of memory, especially when distributing long messages to multiple threads. The API is unchanged.

          •  20 May 2003 01:42

            Release Notes: Cheap Threads now offers a timeout facility as a compiletime option. A thread may put itself to sleep and be awakened after a specified interval, if some other event doesn't awaken it first. There is now a mailing list for discussion and support of Cheap Threads.


            Project Spotlight


            A Fluent OpenStack client API for Java.


            Project Spotlight

            TurnKey TWiki Appliance

            A TWiki appliance that is easy to use and lightweight.