]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/thread/test/test_5542_3.cpp
import quincy beta 17.1.0
[ceph.git] / ceph / src / boost / libs / thread / test / test_5542_3.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 #include <boost/date_time.hpp>
11
12 void workerFunc()
13 {
14 boost::posix_time::seconds workTime(3);
15
16 std::cout << "Worker: running" << std::endl;
17
18 // Pretend to do something useful...
19 boost::this_thread::sleep(workTime);
20
21 std::cout << "Worker: finished" << std::endl;
22 }
23
24 int main()
25 {
26 std::cout << "main: startup" << std::endl;
27
28 boost::thread workerThread(workerFunc);
29
30 std::cout << "main: waiting for thread" << std::endl;
31
32 workerThread.join();
33
34 std::cout << "main: done" << std::endl;
35
36 return 0;
37 }