]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/thread/test/test_5891.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / thread / test / test_5891.cpp
1 // Copyright (C) 2010 Vicente Botet
2 //
3 // Distributed under the Boost Software License, Version 1.0. (See accompanying
4 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5
6 #define BOOST_THREAD_VERSION 2
7
8 #include <iostream>
9 #include <boost/thread/thread_only.hpp>
10
11 using namespace std;
12 using namespace boost;
13
14 struct X {
15 void operator()()
16 {
17 boost::this_thread::sleep(posix_time::seconds(2));
18 }
19 };
20 int main()
21 {
22 X run;
23 boost::thread myThread(run);
24 boost::this_thread::yield();
25 if(myThread.timed_join(posix_time::seconds(5)))
26 {
27 cout << "thats ok";
28 return 0;
29 }
30 else
31 {
32 cout << "too late";
33 return 1;
34 }
35 }