Ticket #7665: sleep_for_test.cpp

File sleep_for_test.cpp, 485 bytes (added by ewdevel@…, 10 years ago)

Test for sleep_for that fails when time is changed.

Line 
1#include <iostream>
2#include <boost/thread.hpp>
3
4void 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
12boost::thread example(thread);
13
14int 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