src/corosio/src/detail/posix/signals.hpp
100.0% Lines (1/1)
100.0% Functions (1/1)
src/corosio/src/detail/posix/signals.hpp
| 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 | #ifndef BOOST_COROSIO_DETAIL_POSIX_SIGNALS_HPP | |
| 11 | #define BOOST_COROSIO_DETAIL_POSIX_SIGNALS_HPP | |
| 12 | ||
| 13 | #include <boost/corosio/detail/platform.hpp> | |
| 14 | ||
| 15 | #if BOOST_COROSIO_POSIX | |
| 16 | ||
| 17 | #include <boost/corosio/detail/config.hpp> | |
| 18 | #include <boost/corosio/signal_set.hpp> | |
| 19 | #include <boost/capy/ex/execution_context.hpp> | |
| 20 | ||
| 21 | /* | |
| 22 | POSIX Signal Service | |
| 23 | ==================== | |
| 24 | ||
| 25 | This header declares the abstract signal service interface. The concrete | |
| 26 | implementation (posix_signals_impl) is in signals.cpp. | |
| 27 | ||
| 28 | This follows the timer_service pattern: | |
| 29 | - posix_signals is an abstract base class (no scheduler dependency) | |
| 30 | - posix_signals_impl is the concrete implementation | |
| 31 | - get_signal_service(ctx, sched) creates the service with scheduler ref | |
| 32 | ||
| 33 | See signals.cpp for the full implementation overview. | |
| 34 | */ | |
| 35 | ||
| 36 | namespace boost::corosio::detail { | |
| 37 | ||
| 38 | struct scheduler; | |
| 39 | ||
| 40 | ||
| 41 | /** Abstract signal service for POSIX backends. | |
| 42 | ||
| 43 | This is the base class that defines the interface. The concrete | |
| 44 | implementation (posix_signals_impl) is created via get_signal_service() | |
| 45 | which passes the scheduler reference. | |
| 46 | */ | |
| 47 | class posix_signals | |
| 48 | : public capy::execution_context::service | |
| 49 | , public io_object::io_service | |
| 50 | { | |
| 51 | public: | |
| 52 | ||
| 53 | protected: | |
| 54 | 336 | posix_signals() = default; |
| 55 | }; | |
| 56 | ||
| 57 | ||
| 58 | /** Get or create the signal service for the given context. | |
| 59 | ||
| 60 | This function is called by the concrete scheduler during initialization | |
| 61 | to create the signal service with a reference to itself. | |
| 62 | ||
| 63 | @param ctx Reference to the owning execution_context. | |
| 64 | @param sched Reference to the scheduler for posting completions. | |
| 65 | @return Reference to the signal service. | |
| 66 | */ | |
| 67 | posix_signals& | |
| 68 | get_signal_service(capy::execution_context& ctx, scheduler& sched); | |
| 69 | ||
| 70 | } // namespace boost::corosio::detail | |
| 71 | ||
| 72 | #endif // BOOST_COROSIO_POSIX | |
| 73 | ||
| 74 | #endif // BOOST_COROSIO_DETAIL_POSIX_SIGNALS_HPP | |
| 75 |