Adilol

C++ boost threading.

Sep 6th, 2011
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.33 KB | None | 0 0
  1. #include <boost/thread.hpp>
  2.  
  3. void task1() {
  4.     // do stuff
  5. }
  6.  
  7. void task2() {
  8.     // do stuff
  9. }
  10.  
  11. int main (int argc, char ** argv) {
  12.     using namespace boost;
  13.     thread thread_1 = thread(task1);
  14.     thread thread_2 = thread(task2);
  15.  
  16.     // do other stuff
  17.     thread_2.join();
  18.     thread_1.join();
  19.     return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment