1 | #include <iostream>
|
---|
2 | #include <iomanip>
|
---|
3 | #include <boost/thread.hpp>
|
---|
4 | #include <boost/date_time.hpp>
|
---|
5 |
|
---|
6 | using std::cout;
|
---|
7 | using std::cerr;
|
---|
8 | using std::endl;
|
---|
9 | using std::exception;
|
---|
10 |
|
---|
11 | int 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 | }
|
---|