src/corosio/src/epoll_context.cpp
100.0% Lines (13/13)
100.0% Functions (3/3)
src/corosio/src/epoll_context.cpp
| Line | 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/epoll_context.hpp> | |
| 11 | ||
| 12 | #if BOOST_COROSIO_HAS_EPOLL | |
| 13 | ||
| 14 | #include "src/detail/epoll/scheduler.hpp" | |
| 15 | #include "src/detail/epoll/sockets.hpp" | |
| 16 | #include "src/detail/epoll/acceptors.hpp" | |
| 17 | ||
| 18 | #include <thread> | |
| 19 | ||
| 20 | namespace boost::corosio { | |
| 21 | ||
| 22 | 202 | epoll_context::epoll_context() |
| 23 | 202 | : epoll_context(std::thread::hardware_concurrency()) |
| 24 | { | |
| 25 | 202 | } |
| 26 | ||
| 27 | 203 | epoll_context::epoll_context(unsigned concurrency_hint) |
| 28 | { | |
| 29 | 406 | sched_ = &make_service<detail::epoll_scheduler>( |
| 30 | 203 | static_cast<int>(concurrency_hint)); |
| 31 | ||
| 32 | 203 | make_service<detail::epoll_socket_service>(); |
| 33 | 203 | make_service<detail::epoll_acceptor_service>(); |
| 34 | 203 | } |
| 35 | ||
| 36 | 203 | epoll_context::~epoll_context() |
| 37 | { | |
| 38 | 203 | shutdown(); |
| 39 | 203 | destroy(); |
| 40 | 203 | } |
| 41 | ||
| 42 | } // namespace boost::corosio | |
| 43 | ||
| 44 | #endif // BOOST_COROSIO_HAS_EPOLL | |
| 45 |