]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/asio/detail/null_thread.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / asio / detail / null_thread.hpp
1 //
2 // detail/null_thread.hpp
3 // ~~~~~~~~~~~~~~~~~~~~~~
4 //
5 // Copyright (c) 2003-2017 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 BOOST_ASIO_DETAIL_NULL_THREAD_HPP
12 #define BOOST_ASIO_DETAIL_NULL_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 <boost/asio/detail/config.hpp>
19
20 #if !defined(BOOST_ASIO_HAS_THREADS)
21
22 #include <boost/asio/detail/noncopyable.hpp>
23 #include <boost/asio/detail/throw_error.hpp>
24 #include <boost/asio/error.hpp>
25
26 #include <boost/asio/detail/push_options.hpp>
27
28 namespace boost {
29 namespace asio {
30 namespace detail {
31
32 class null_thread
33 : private noncopyable
34 {
35 public:
36 // Constructor.
37 template <typename Function>
38 null_thread(Function, unsigned int = 0)
39 {
40 boost::asio::detail::throw_error(
41 boost::asio::error::operation_not_supported, "thread");
42 }
43
44 // Destructor.
45 ~null_thread()
46 {
47 }
48
49 // Wait for the thread to exit.
50 void join()
51 {
52 }
53
54 // Get number of CPUs.
55 static std::size_t hardware_concurrency()
56 {
57 return 1;
58 }
59 };
60
61 } // namespace detail
62 } // namespace asio
63 } // namespace boost
64
65 #include <boost/asio/detail/pop_options.hpp>
66
67 #endif // !defined(BOOST_ASIO_HAS_THREADS)
68
69 #endif // BOOST_ASIO_DETAIL_NULL_THREAD_HPP