Ticket #5481: test_thread.cpp

File test_thread.cpp, 558 bytes (added by Leo Carreon <lcarreon@…>, 12 years ago)

The test program

Line 
1#include <iostream>
2#include <iomanip>
3#include <boost/thread.hpp>
4#include <boost/date_time.hpp>
5
6using std::cout;
7using std::cerr;
8using std::endl;
9using std::exception;
10
11int main()
12{
13 try
14 {
15 cout << "Main thread ID = " << boost::this_thread::get_id() << endl;
16 int vDuration = 500;
17 cout << "Sleeping for " << vDuration << " milliseconds" << endl;
18 boost::this_thread::sleep(boost::posix_time::milliseconds(vDuration));
19 cout << endl;
20
21 return 0;
22 }
23 catch (exception& e)
24 {
25 cerr << e.what() << endl;
26 return 1;
27 }
28}