Realistic 3D camera system
3D camera system components
std_thread.hpp
Go to the documentation of this file.
1 //
2 // detail/std_thread.hpp
3 // ~~~~~~~~~~~~~~~~~~~~~
4 //
5 // Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
6 //
7 // Distributed under the Boost Software License, Version 1.0. (See accompanying
8 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9 //
10 
11 #ifndef ASIO_DETAIL_STD_THREAD_HPP
12 #define ASIO_DETAIL_STD_THREAD_HPP
13 
14 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
15 # pragma once
16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
17 
18 #include "asio/detail/config.hpp"
19 
20 #if defined(ASIO_HAS_STD_THREAD)
21 
22 #include <thread>
24 
26 
27 namespace asio {
28 namespace detail {
29 
30 class std_thread
31  : private noncopyable
32 {
33 public:
34  // Constructor.
35  template <typename Function>
36  std_thread(Function f, unsigned int = 0)
37  : thread_(f)
38  {
39  }
40 
41  // Destructor.
42  ~std_thread()
43  {
44  join();
45  }
46 
47  // Wait for the thread to exit.
48  void join()
49  {
50  if (thread_.joinable())
51  thread_.join();
52  }
53 
54 private:
55  std::thread thread_;
56 };
57 
58 } // namespace detail
59 } // namespace asio
60 
62 
63 #endif // defined(ASIO_HAS_STD_THREAD)
64 
65 #endif // ASIO_DETAIL_STD_THREAD_HPP
null_thread thread
Definition: thread.hpp:40