]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | // |
2 | // detail/null_thread.hpp | |
3 | // ~~~~~~~~~~~~~~~~~~~~~~ | |
4 | // | |
5 | // Copyright (c) 2003-2016 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 | ||
55 | } // namespace detail | |
56 | } // namespace asio | |
57 | } // namespace boost | |
58 | ||
59 | #include <boost/asio/detail/pop_options.hpp> | |
60 | ||
61 | #endif // !defined(BOOST_ASIO_HAS_THREADS) | |
62 | ||
63 | #endif // BOOST_ASIO_DETAIL_NULL_THREAD_HPP |