• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

STEllAR-GROUP / hpx / #853

19 Dec 2022 01:01AM UTC coverage: 86.287% (+0.4%) from 85.912%
#853

push

StellarBot
Merge #6109

6109: Modernize serialization module r=hkaiser a=hkaiser

- flyby separate serialization of Boost types

working towards https://github.com/STEllAR-GROUP/hpx/issues/5497

Co-authored-by: Hartmut Kaiser <hartmut.kaiser@gmail.com>

53 of 53 new or added lines in 6 files covered. (100.0%)

173939 of 201582 relevant lines covered (86.29%)

1931657.12 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

20.97
/libs/core/runtime_local/src/runtime_handlers.cpp
1
//  Copyright (c) 2007-2017 Hartmut Kaiser
2
//  Copyright (c)      2017 Shoshana Jakobovits
3
//  Copyright (c) 2010-2011 Phillip LeBlanc, Dylan Stark
4
//  Copyright (c)      2011 Bryce Lelbach
5
//
6
//  SPDX-License-Identifier: BSL-1.0
7
//  Distributed under the Boost Software License, Version 1.0. (See accompanying
8
//  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9

10
#include <hpx/config.hpp>
11
#include <hpx/assert.hpp>
12
#include <hpx/debugging/backtrace.hpp>
13
#include <hpx/modules/errors.hpp>
14
#include <hpx/modules/logging.hpp>
15
#include <hpx/modules/threadmanager.hpp>
16
#include <hpx/runtime_local/config_entry.hpp>
17
#include <hpx/runtime_local/custom_exception_info.hpp>
18
#include <hpx/runtime_local/debugging.hpp>
19
#include <hpx/runtime_local/runtime_handlers.hpp>
20
#include <hpx/runtime_local/runtime_local.hpp>
21
#include <hpx/threading_base/thread_data.hpp>
22
#include <hpx/threading_base/thread_pool_base.hpp>
23

24
#include <asio/io_context.hpp>
25

26
#include <cstddef>
27
#include <iostream>
28
#include <sstream>
29
#include <string>
30

31
namespace hpx { namespace detail {
32

33
    [[noreturn]] void assertion_handler(hpx::source_location const& loc,
×
34
        const char* expr, std::string const& msg)
35
    {
36
        static thread_local bool handling_assertion = false;
37

38
        if (handling_assertion)
×
39
        {
40
            std::ostringstream strm;
×
41
            strm << "Trying to handle failed assertion while handling another "
×
42
                    "failed assertion!"
43
                 << std::endl;
×
44
            strm << "Assertion '" << expr << "' failed";
×
45
            if (!msg.empty())
×
46
            {
47
                strm << " (" << msg << ")";
×
48
            }
×
49

50
            strm << std::endl;
×
51
            strm << "{file}: " << loc.file_name() << std::endl;
×
52
            strm << "{line}: " << loc.line() << std::endl;
×
53
            strm << "{function}: " << loc.function_name() << std::endl;
×
54

55
            std::cerr << strm.str();
×
56

57
            std::abort();
×
58
        }
×
59

60
        handling_assertion = true;
×
61

62
        hpx::util::may_attach_debugger("exception");
×
63

64
        std::ostringstream strm;
×
65
        strm << "Assertion '" << expr << "' failed";
×
66
        if (!msg.empty())
×
67
        {
68
            strm << " (" << msg << ")";
×
69
        }
×
70

71
        hpx::exception e(hpx::error::assertion_failure, strm.str());
×
72
        std::cerr << hpx::diagnostic_information(hpx::detail::get_exception(
×
73
                         e, loc.function_name(), loc.file_name(), loc.line()))
×
74
                  << std::endl;
×
75
        std::abort();
×
76
    }
×
77

78
#if defined(HPX_HAVE_APEX)
79
    bool enable_parent_task_handler()
80
    {
81
        return !hpx::is_networking_enabled();
82
    }
83
#endif
84

85
    void test_failure_handler()
924✔
86
    {
87
        hpx::util::may_attach_debugger("test-failure");
924✔
88
    }
924✔
89

90
#if defined(HPX_HAVE_VERIFY_LOCKS)
91
    void registered_locks_error_handler()
×
92
    {
93
        std::string back_trace = hpx::util::trace(std::size_t(128));
×
94

95
        // throw or log, depending on config options
96
        if (get_config_entry("hpx.throw_on_held_lock", "1") == "0")
×
97
        {
98
            if (back_trace.empty())
×
99
            {
100
                LERR_(debug).format(
×
101
                    "suspending thread while at least one lock is being held "
×
102
                    "(stack backtrace was disabled at compile time)");
103
            }
×
104
            else
105
            {
106
                LERR_(debug).format("suspending thread while at least one lock "
×
107
                                    "is being held, stack backtrace: {}",
108
                    back_trace);
109
            }
110
        }
×
111
        else
112
        {
113
            if (back_trace.empty())
×
114
            {
115
                HPX_THROW_EXCEPTION(hpx::error::invalid_status,
×
116
                    "verify_no_locks",
117
                    "suspending thread while at least one lock is "
118
                    "being held (stack backtrace was disabled at "
119
                    "compile time)");
120
            }
121
            else
122
            {
123
                HPX_THROW_EXCEPTION(hpx::error::invalid_status,
×
124
                    "verify_no_locks",
125
                    "suspending thread while at least one lock is "
126
                    "being held, stack backtrace: {}",
127
                    back_trace);
128
            }
129
        }
130
    }
×
131

132
    bool register_locks_predicate()
494,978,261✔
133
    {
134
        return threads::get_self_ptr() != nullptr;
494,978,261✔
135
    }
136
#endif
137

138
    threads::thread_pool_base* get_default_pool()
1,203,753✔
139
    {
140
        hpx::runtime* rt = get_runtime_ptr();
1,203,753✔
141
        if (rt == nullptr)
1,203,748✔
142
        {
143
            HPX_THROW_EXCEPTION(hpx::error::invalid_status,
×
144
                "hpx::detail::get_default_pool",
145
                "The runtime system is not active");
146
        }
147

148
        return &rt->get_thread_manager().default_pool();
1,203,748✔
149
    }
×
150

151
    asio::io_context* get_default_timer_service()
12,145✔
152
    {
153
        hpx::runtime* rt = get_runtime_ptr();
12,145✔
154
        if (rt == nullptr)
12,145✔
155
        {
156
            HPX_THROW_EXCEPTION(hpx::error::invalid_status,
×
157
                "hpx::detail::get_default_timer_service",
158
                "The runtime system is not active");
159
        }
160

161
        return &get_thread_pool("timer-pool")->get_io_service();
12,145✔
162
    }
×
163

164
    threads::mask_type get_pu_mask(
×
165
        threads::topology& /* topo */, std::size_t thread_num)
166
    {
167
        auto& rp = hpx::resource::get_partitioner();
×
168
        return rp.get_pu_mask(thread_num);
×
169
    }
170
}}    // namespace hpx::detail
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc