]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/boost/asio/system_context.hpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / boost / asio / system_context.hpp
CommitLineData
b32b8144
FG
1//
2// system_context.hpp
3// ~~~~~~~~~~~~~~~~~~
4//
1e59de90 5// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
b32b8144
FG
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_SYSTEM_CONTEXT_HPP
12#define BOOST_ASIO_SYSTEM_CONTEXT_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#include <boost/asio/detail/scheduler.hpp>
20#include <boost/asio/detail/thread_group.hpp>
20effc67 21#include <boost/asio/execution.hpp>
b32b8144
FG
22#include <boost/asio/execution_context.hpp>
23
24#include <boost/asio/detail/push_options.hpp>
25
26namespace boost {
27namespace asio {
28
20effc67
TL
29template <typename Blocking, typename Relationship, typename Allocator>
30class basic_system_executor;
b32b8144
FG
31
32/// The executor context for the system executor.
33class system_context : public execution_context
34{
35public:
36 /// The executor type associated with the context.
20effc67
TL
37 typedef basic_system_executor<
38 execution::blocking_t::possibly_t,
39 execution::relationship_t::fork_t,
40 std::allocator<void>
41 > executor_type;
b32b8144
FG
42
43 /// Destructor shuts down all threads in the system thread pool.
44 BOOST_ASIO_DECL ~system_context();
45
46 /// Obtain an executor for the context.
47 executor_type get_executor() BOOST_ASIO_NOEXCEPT;
48
49 /// Signal all threads in the system thread pool to stop.
50 BOOST_ASIO_DECL void stop();
51
52 /// Determine whether the system thread pool has been stopped.
53 BOOST_ASIO_DECL bool stopped() const BOOST_ASIO_NOEXCEPT;
54
55 /// Join all threads in the system thread pool.
56 BOOST_ASIO_DECL void join();
57
58#if defined(GENERATING_DOCUMENTATION)
59private:
60#endif // defined(GENERATING_DOCUMENTATION)
61 // Constructor creates all threads in the system thread pool.
62 BOOST_ASIO_DECL system_context();
63
64private:
20effc67 65 template <typename, typename, typename> friend class basic_system_executor;
b32b8144
FG
66
67 struct thread_function;
68
92f5a8d4
TL
69 // Helper function to create the underlying scheduler.
70 BOOST_ASIO_DECL detail::scheduler& add_scheduler(detail::scheduler* s);
71
b32b8144
FG
72 // The underlying scheduler.
73 detail::scheduler& scheduler_;
74
75 // The threads in the system thread pool.
76 detail::thread_group threads_;
20effc67
TL
77
78 // The number of threads in the pool.
79 std::size_t num_threads_;
b32b8144
FG
80};
81
82} // namespace asio
83} // namespace boost
84
85#include <boost/asio/detail/pop_options.hpp>
86
87#include <boost/asio/impl/system_context.hpp>
88#if defined(BOOST_ASIO_HEADER_ONLY)
89# include <boost/asio/impl/system_context.ipp>
90#endif // defined(BOOST_ASIO_HEADER_ONLY)
91
92#endif // BOOST_ASIO_SYSTEM_CONTEXT_HPP