LCOV - code coverage report
Current view: top level - src/detail - resume_coro.hpp (source / functions) Coverage Total Hit
Test: coverage_filtered.info Lines: 80.0 % 5 4
Test Date: 2026-02-04 14:16:13 Functions: 100.0 % 1 1

            Line data    Source code
       1              : //
       2              : // Copyright (c) 2026 Vinnie Falco (vinnie dot falco at gmail dot com)
       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_RESUME_CORO_HPP
      11              : #define BOOST_COROSIO_DETAIL_RESUME_CORO_HPP
      12              : 
      13              : #include <boost/corosio/basic_io_context.hpp>
      14              : #include <boost/capy/ex/executor_ref.hpp>
      15              : #include <boost/capy/detail/type_id.hpp>
      16              : #include <boost/capy/coro.hpp>
      17              : 
      18              : namespace boost::corosio::detail {
      19              : 
      20              : /** Resumes a coroutine for I/O completion.
      21              : 
      22              :     If the executor is io_context::executor_type, resumes directly
      23              :     to avoid dispatch overhead. Otherwise dispatches through the
      24              :     executor. No memory fence is needed since GQCS/epoll_wait
      25              :     provide acquire semantics.
      26              : 
      27              :     @param d The executor to dispatch through.
      28              :     @param h The coroutine handle to resume.
      29              : */
      30              : inline void
      31       120378 : resume_coro(capy::executor_ref d, capy::coro h)
      32              : {
      33              :     // Fast path: resume directly for io_context executor
      34       120378 :     if (&d.type_id() == &capy::detail::type_id<basic_io_context::executor_type>())
      35       120378 :         h.resume();
      36              :     else
      37            0 :         d.dispatch(h);
      38       120378 : }
      39              : 
      40              : } // namespace boost::corosio::detail
      41              : 
      42              : #endif
        

Generated by: LCOV version 2.3