100.00% Lines (3/3) 100.00% Functions (1/1)
TLA Baseline Branch
Line Hits Code Line Hits Code
  1 + //
  2 + // Copyright (c) 2026 Michael Vandeberg
  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/capy
  8 + //
  9 +
  10 + #ifndef BOOST_CAPY_DETAIL_QUITTER_STOPPED_HPP
  11 + #define BOOST_CAPY_DETAIL_QUITTER_STOPPED_HPP
  12 +
  13 + #include <boost/capy/detail/config.hpp>
  14 + #include <boost/capy/error.hpp>
  15 +
  16 + #include <system_error>
  17 +
  18 + /* What a stopped quitter<T> throws when T cannot hold canceled (void,
  19 + or a plain T). It is a std::system_error with canceled, so callers
  20 + catch it as one. Its own type lets run_async's default_handler drop
  21 + a quitter's stop that escapes a task, while it still terminates on
  22 + any other exception, a real ECANCELED included. A handler that
  23 + catches it and throws a std::system_error copy loses the type.
  24 + The type is visible so that catch still matches a stop thrown from
  25 + another shared library in a hidden-visibility build. */
  26 +
  27 + namespace boost {
  28 + namespace capy {
  29 + namespace detail {
  30 +
  31 + struct BOOST_CAPY_SYMBOL_VISIBLE
  32 + quitter_stopped
  33 + : std::system_error
  34 + {
HITGNC   35 + 29 quitter_stopped()
HITGNC   36 + 29 : std::system_error(make_error_code(error::canceled))
  37 + {
HITGNC   38 + 29 }
  39 + };
  40 +
  41 + } // namespace detail
  42 + } // namespace capy
  43 + } // namespace boost
  44 +
  45 + #endif