src/corosio/src/select_context.cpp

100.0% Lines (15/15) 100.0% Functions (3/3) 100.0% Branches (3/3)
src/corosio/src/select_context.cpp
Line Branch Hits 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 #include <boost/corosio/select_context.hpp>
11
12 #if BOOST_COROSIO_HAS_SELECT
13
14 #include "src/detail/select/scheduler.hpp"
15 #include "src/detail/select/sockets.hpp"
16 #include "src/detail/select/acceptors.hpp"
17
18 #include <thread>
19
20 namespace boost::corosio {
21
22 133 select_context::
23 133 select_context()
24 133 : select_context(std::thread::hardware_concurrency())
25 {
26 133 }
27
28 133 select_context::
29 select_context(
30 133 unsigned concurrency_hint)
31 {
32 266 sched_ = &make_service<detail::select_scheduler>(
33
1/1
✓ Branch 1 taken 133 times.
133 static_cast<int>(concurrency_hint));
34
35
1/1
✓ Branch 1 taken 133 times.
133 make_service<detail::select_socket_service>();
36
1/1
✓ Branch 1 taken 133 times.
133 make_service<detail::select_acceptor_service>();
37 133 }
38
39 133 select_context::
40 ~select_context()
41 {
42 133 shutdown();
43 133 destroy();
44 133 }
45
46 } // namespace boost::corosio
47
48 #endif // BOOST_COROSIO_HAS_SELECT
49