1//
2// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
3//
4// Distributed under the Boost Software License, Version 1.0. (See accompanying
5// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6//
7// Official repository: https://github.com/boostorg/beast
8//
9
10#ifndef BOOST_BEAST_WEBSOCKET_DETAIL_SERVICE_HPP
11#define BOOST_BEAST_WEBSOCKET_DETAIL_SERVICE_HPP
12
13#include <boost/beast/core/detail/service_base.hpp>
14#include <boost/asio/execution_context.hpp>
15#include <boost/enable_shared_from_this.hpp>
16#include <mutex>
17#include <vector>
18
19namespace boost {
20namespace beast {
21namespace websocket {
22namespace detail {
23
24class service
25 : public beast::detail::service_base<service>
26{
27public:
28 class impl_type
29 : public boost::enable_shared_from_this<impl_type>
30 {
31 service& svc_;
32 std::size_t index_;
33
34 friend class service;
35
36 public:
37 virtual ~impl_type() = default;
38
39 BOOST_BEAST_DECL
40 explicit
41 impl_type(net::execution_context& ctx);
42
43 BOOST_BEAST_DECL
44 void
45 remove();
46
47 virtual
48 void
49 shutdown() = 0;
50 };
51
52private:
53 std::mutex m_;
54 std::vector<impl_type*> v_;
55
56 BOOST_BEAST_DECL
57 void
58 shutdown() override;
59
60public:
61 BOOST_BEAST_DECL
62 explicit
63 service(net::execution_context& ctx)
64 : beast::detail::service_base<service>(ctx)
65 {
66 }
67};
68
69} // detail
70} // websocket
71} // beast
72} // boost
73
74#if BOOST_BEAST_HEADER_ONLY
75#include <boost/beast/websocket/detail/service.ipp>
76#endif
77
78#endif
79

source code of boost/libs/beast/include/boost/beast/websocket/detail/service.hpp