LCOV - code coverage report
Current view: top level - corosio/native/detail/reactor - reactor_op_base.hpp (source / functions) Coverage Total Hit Missed
Test: coverage_remapped.info Lines: 50.0 % 8 4 4
Test Date: 2026-06-09 16:09:19 Functions: 33.3 % 3 1 2

           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_OP_BASE_HPP
      11                 : #define BOOST_COROSIO_NATIVE_DETAIL_REACTOR_REACTOR_OP_BASE_HPP
      12                 : 
      13                 : #include <boost/corosio/native/detail/coro_op.hpp>
      14                 : 
      15                 : #include <cstddef>
      16                 : 
      17                 : namespace boost::corosio::detail {
      18                 : 
      19                 : /** Non-template base for reactor operations.
      20                 : 
      21                 :     Adds the reactor-specific result model (the recorded errno + bytes and
      22                 :     the perform_io() readiness re-run) on top of coro_op, the shared op
      23                 :     envelope (coroutine handle, executor, output pointers, stop_token wiring,
      24                 :     cancelled flag, impl_ptr keepalive) common to every backend.
      25                 : 
      26                 :     Kept as a non-template layer so reactor_descriptor_state and the
      27                 :     scheduler hot paths can touch op state without knowing the concrete
      28                 :     socket/acceptor types.
      29                 : 
      30                 :     @see coro_op, reactor_op
      31                 : */
      32                 : struct reactor_op_base : coro_op
      33                 : {
      34                 :     /// Errno from the last I/O attempt.
      35                 :     int errn = 0;
      36                 : 
      37                 :     /// Bytes transferred on success.
      38                 :     std::size_t bytes_transferred = 0;
      39                 : 
      40                 :     // cancelled, impl_ptr, and request_cancel() are inherited from coro_op.
      41                 : 
      42                 :     /// Record the result of an I/O attempt.
      43 HIT      102180 :     void complete(int err, std::size_t bytes) noexcept
      44                 :     {
      45          102180 :         errn              = err;
      46          102180 :         bytes_transferred = bytes;
      47          102180 :     }
      48                 : 
      49                 :     /// Perform the I/O syscall (overridden by concrete op types).
      50 MIS           0 :     virtual void perform_io() noexcept {}
      51                 : 
      52                 :     /// Destroy without invoking — drop the keepalive (impl_ptr from coro_op).
      53               0 :     void destroy() override
      54                 :     {
      55               0 :         impl_ptr.reset();
      56               0 :     }
      57                 : };
      58                 : 
      59                 : } // namespace boost::corosio::detail
      60                 : 
      61                 : #endif // BOOST_COROSIO_NATIVE_DETAIL_REACTOR_REACTOR_OP_BASE_HPP
        

Generated by: LCOV version 2.3