TinyThread++ 实现了C++0x 线程管理类库的一个兼容子集。 

 

  1. // Thread function 
  2.  
  3.     void MyThread(void * arg) 
  4.  
  5.     { 
  6.  
  7.       // Do child thread stuff 
  8.  
  9.     } 
  10.  
  11.      
  12.  
  13.     // Start the child thread 
  14.  
  15.     thread t(MyThread, 0); 
  16.  
  17.      
  18.  
  19.     // Do main thread stuff 
  20.  
  21.     // ... 
  22.  
  23.      
  24.  
  25.     // Wait for the child thread to finish 
  26.  
  27.     t.join();