I had a hard time finding OpenThreads sample code. OpenThreads provides a cross platform threading library that supports Mac OS X, Linux, and Windows. It seems most people suggest looking at OpenSceneGraph, but that’s not really a basic example. In the spirit of uncommon code, here is a minimal OpenThreads example:

OpenThreads also provides a yield function and sleep function, OpenThreads::Thread::YieldCurrentThread(); and OpenThreads::Thread::microSleep(int milliseconds); respectively. In addition, OpenThreads allows scheduling process affinity. The source for Thread can be found in OpenSceneGraph.