Ticket #7665: sleep_for_test.cpp
File sleep_for_test.cpp, 485 bytes (added by , 10 years ago) |
---|
Line | |
---|---|
1 | #include <iostream> |
2 | #include <boost/thread.hpp> |
3 | |
4 | void thread() |
5 | { |
6 | std::cout << "Sleeping for 10 seconds - change time\n"; |
7 | boost::this_thread::sleep_for(boost::chrono::seconds(10)); |
8 | std::cout << "Ended\n"; |
9 | while(1); // Never quit |
10 | } |
11 | |
12 | boost::thread example(thread); |
13 | |
14 | int main() |
15 | { |
16 | std::cout << "Main thread START\n"; |
17 | boost::this_thread::sleep_for(boost::chrono::seconds(10)); |
18 | std::cout << "Main thread END\n"; |
19 | while(1); // Never quit |
20 | } |
21 |