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

STEllAR-GROUP / hpx / #857

28 Dec 2022 11:12PM UTC coverage: 86.543% (-0.06%) from 86.602%
#857

push

StellarBot
Merge #6118

6118: Modernize modules from level 17, 18, 19, and 20 r=hkaiser a=hkaiser

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

Modules:
- core/threading_base
- full/command_line_handling
- core/io_service
- core/schedulers
- core/synchronization
- core/futures
- core/thread_pools
- core/lcos_local
- core/pack_traversal
- core/resource_partitioner
- core/threading
- full/naming_base


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

849 of 849 new or added lines in 98 files covered. (100.0%)

174389 of 201505 relevant lines covered (86.54%)

1916353.25 hits per line

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

84.85
/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/functional/function.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()
9,715✔
19
      : on_start_thread_callbacks_()
9,715✔
20
      , on_stop_thread_callbacks_()
9,715✔
21
      , on_error_()
9,715✔
22
    {
23
    }
9,715✔
24

25
    void callback_notifier::on_start_thread(std::size_t local_thread_num,
11,024✔
26
        std::size_t global_thread_num, char const* pool_name,
27
        char const* postfix) const
28
    {
29
        for (auto& callback : on_start_thread_callbacks_)
29,560✔
30
        {
31
            if (callback)
18,409✔
32
            {
33
                callback(
36,818✔
34
                    local_thread_num, global_thread_num, pool_name, postfix);
18,536✔
35
            }
18,536✔
36
        }
37
    }
11,029✔
38

39
    void callback_notifier::on_stop_thread(std::size_t local_thread_num,
10,977✔
40
        std::size_t global_thread_num, char const* pool_name,
41
        char const* postfix) const
42
    {
43
        for (auto& callback : on_stop_thread_callbacks_)
29,404✔
44
        {
45
            if (callback)
18,313✔
46
            {
47
                callback(
36,626✔
48
                    local_thread_num, global_thread_num, pool_name, postfix);
18,427✔
49
            }
18,427✔
50
        }
51
    }
11,013✔
52

53
    bool callback_notifier::on_error(
×
54
        std::size_t global_thread_num, std::exception_ptr const& e) const
55
    {
56
        if (on_error_)
×
57
        {
58
            return on_error_(global_thread_num, e);
×
59
        }
60
        return true;
×
61
    }
×
62

63
    void callback_notifier::add_on_start_thread_callback(
6,684✔
64
        on_startstop_type const& callback)
65
    {
66
        on_start_thread_callbacks_.push_back(callback);
6,684✔
67
    }
6,684✔
68

69
    void callback_notifier::add_on_stop_thread_callback(
6,684✔
70
        on_startstop_type const& callback)
71
    {
72
        on_stop_thread_callbacks_.push_front(callback);
6,684✔
73
    }
6,684✔
74

75
    void callback_notifier::set_on_error_callback(on_error_type const& callback)
4,248✔
76
    {
77
        on_error_ = callback;
4,248✔
78
    }
4,248✔
79
}    // 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