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

STEllAR-GROUP / hpx / #882

31 Aug 2023 07:44PM UTC coverage: 41.798% (-44.7%) from 86.546%
#882

push

19442 of 46514 relevant lines covered (41.8%)

126375.38 hits per line

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

86.36
/libs/core/threading_base/src/callback_notifier.cpp
1
//  Copyright (c) 2007-2022 Hartmut Kaiser
2
//
3
//  SPDX-License-Identifier: BSL-1.0
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
#include <hpx/config.hpp>
8
#include <hpx/modules/functional.hpp>
9
#include <hpx/threading_base/callback_notifier.hpp>
10

11
#include <cstddef>
12
#include <deque>
13
#include <exception>
14

15
///////////////////////////////////////////////////////////////////////////////
16
namespace hpx::threads::policies {
17

18
    callback_notifier::callback_notifier() = default;
1,024✔
19

20
    void callback_notifier::on_start_thread(std::size_t local_thread_num,
470✔
21
        std::size_t global_thread_num, char const* pool_name,
22
        char const* postfix) const
23
    {
24
        for (auto& callback : on_start_thread_callbacks_)
1,136✔
25
        {
26
            if (callback)
666✔
27
            {
28
                callback(
666✔
29
                    local_thread_num, global_thread_num, pool_name, postfix);
30
            }
31
        }
32
    }
470✔
33

34
    void callback_notifier::on_stop_thread(std::size_t local_thread_num,
470✔
35
        std::size_t global_thread_num, char const* pool_name,
36
        char const* postfix) const
37
    {
38
        for (auto& callback : on_stop_thread_callbacks_)
1,136✔
39
        {
40
            if (callback)
666✔
41
            {
42
                callback(
666✔
43
                    local_thread_num, global_thread_num, pool_name, postfix);
44
            }
45
        }
46
    }
470✔
47

48
    bool callback_notifier::on_error(
×
49
        std::size_t global_thread_num, std::exception_ptr const& e) const
50
    {
51
        if (on_error_)
×
52
        {
53
            return on_error_(global_thread_num, e);
×
54
        }
55
        return true;
56
    }
57

58
    void callback_notifier::add_on_start_thread_callback(
352✔
59
        on_startstop_type const& callback)
60
    {
61
        on_start_thread_callbacks_.push_back(callback);
352✔
62
    }
352✔
63

64
    void callback_notifier::add_on_stop_thread_callback(
352✔
65
        on_startstop_type const& callback)
66
    {
67
        on_stop_thread_callbacks_.push_front(callback);
352✔
68
    }
352✔
69

70
    void callback_notifier::set_on_error_callback(on_error_type const& callback)
224✔
71
    {
72
        on_error_ = callback;
73
    }
224✔
74
}    // namespace hpx::threads::policies
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