TLA Line data Source code
1 : //
2 : // Copyright (c) 2026 Steve Gerbino
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/cppalliance/corosio
8 : //
9 :
10 : #ifndef BOOST_COROSIO_NATIVE_DETAIL_REACTOR_REACTOR_SERVICE_STATE_HPP
11 : #define BOOST_COROSIO_NATIVE_DETAIL_REACTOR_REACTOR_SERVICE_STATE_HPP
12 :
13 : #include <boost/corosio/detail/object_pool.hpp>
14 : #include <boost/corosio/detail/intrusive.hpp>
15 :
16 : namespace boost::corosio::detail {
17 :
18 : /** Shared service state for reactor backends.
19 :
20 : Holds the scheduler reference and the impl recycling pool. Used
21 : by both socket and acceptor services.
22 :
23 : @tparam Scheduler The backend's scheduler type.
24 : @tparam Impl The backend's socket or acceptor impl type.
25 : */
26 : template<class Scheduler, class Impl>
27 : struct reactor_service_state
28 : {
29 : /// Construct with a reference to the owning scheduler.
30 HIT 2142 : explicit reactor_service_state(Scheduler& sched) noexcept : sched_(sched) {}
31 :
32 : /// Reference to the owning scheduler.
33 : Scheduler& sched_;
34 :
35 : /// Owns every impl: live for shutdown traversal, free for reuse.
36 : object_pool<Impl> pool_;
37 : };
38 :
39 : } // namespace boost::corosio::detail
40 :
41 : #endif // BOOST_COROSIO_NATIVE_DETAIL_REACTOR_REACTOR_SERVICE_STATE_HPP
|