• 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

50.0
/libs/full/async_distributed/src/continuation.cpp
1
//  Copyright (c) 2007-2020 Hartmut Kaiser
2
//  Copyright (c) 2016 Thomas Heller
3
//
4
//  SPDX-License-Identifier: BSL-1.0
5
//  Distributed under the Boost Software License, Version 1.0. (See accompanying
6
//  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7

8
#include <hpx/config.hpp>
9
#include <hpx/actions/transfer_action.hpp>
10
#include <hpx/actions_base/traits/action_priority.hpp>
11
#include <hpx/actions_base/traits/extract_action.hpp>
12
#include <hpx/async_distributed/continuation.hpp>
13
#include <hpx/async_distributed/transfer_continuation_action.hpp>
14
#include <hpx/async_distributed/trigger_lco.hpp>
15
#include <hpx/modules/errors.hpp>
16
#include <hpx/naming/credit_handling.hpp>
17

18
#include <exception>
19
#include <utility>
20

21
///////////////////////////////////////////////////////////////////////////////
22
namespace hpx::actions {
23

24
    continuation::continuation() = default;
652✔
25

26
    continuation::continuation(hpx::id_type const& id)
×
27
      : id_(id)
×
28
    {
29
        // Try to resolve the address locally ...
30
        if (id_ && !agas::is_local_address_cached(id_, addr_))
×
31
        {
32
            addr_ = naming::address();
×
33
        }
34
    }
×
35

36
    continuation::continuation(hpx::id_type&& id)
×
37
      : id_(HPX_MOVE(id))
×
38
    {
39
        // Try to resolve the address locally ...
40
        if (id_ && !agas::is_local_address_cached(id_, addr_))
×
41
        {
42
            addr_ = naming::address();
×
43
        }
44
    }
×
45

46
    continuation::continuation(hpx::id_type const& id, naming::address&& addr)
×
47
      : id_(id)
48
      , addr_(HPX_MOVE(addr))
49
    {
50
    }
×
51

52
    continuation::continuation(
40,659✔
53
        hpx::id_type&& id, naming::address&& addr) noexcept
40,659✔
54
      : id_(HPX_MOVE(id))
55
      , addr_(HPX_MOVE(addr))
56
    {
57
    }
40,659✔
58

59
    continuation::continuation(continuation&& o) noexcept = default;
81,488✔
60

61
    continuation& continuation::operator=(continuation&& o) noexcept = default;
×
62

63
    ///////////////////////////////////////////////////////////////////////////
64
    void continuation::trigger_error(std::exception_ptr const& e)
×
65
    {
66
        if (!id_)
67
        {
68
            HPX_THROW_EXCEPTION(hpx::error::invalid_status,
×
69
                "continuation::trigger_error",
70
                "attempt to trigger invalid LCO (the id is invalid)");
71
            return;
72
        }
73

74
        LLCO_(info).format("continuation::trigger_error({})", id_);
×
75
        set_lco_error(id_, this->get_addr(), e);
×
76
    }
77

78
    void continuation::trigger_error(std::exception_ptr&& e)    //-V659
×
79
    {
80
        if (!id_)
81
        {
82
            HPX_THROW_EXCEPTION(hpx::error::invalid_status,
×
83
                "continuation::trigger_error",
84
                "attempt to trigger invalid LCO (the id is invalid)");
85
            return;
86
        }
87

88
        LLCO_(info).format("continuation::trigger_error({})", id_);
×
89
        set_lco_error(id_, this->get_addr(), HPX_MOVE(e));
×
90
    }
91

92
    void continuation::serialize(
186✔
93
        hpx::serialization::input_archive& ar, unsigned)
94
    {
95
        // clang-format off
96
        ar & id_ & addr_;
186✔
97
        // clang-format on
98
    }
186✔
99

100
    void continuation::serialize(
372✔
101
        hpx::serialization::output_archive& ar, unsigned)
102
    {
103
        // clang-format off
104
        ar & id_ & addr_;
372✔
105
        // clang-format on
106
    }
372✔
107

108
    ///////////////////////////////////////////////////////////////////////////
109
    void typed_continuation<void, util::unused_type>::serialize(
24✔
110
        hpx::serialization::input_archive& ar, unsigned)
111
    {
112
        // clang-format off
113
        // serialize base class
114
        ar & hpx::serialization::base_object<continuation>(*this);
24✔
115
        ar & f_;
24✔
116
        // clang-format on
117
    }
24✔
118

119
    void typed_continuation<void, util::unused_type>::serialize(
48✔
120
        hpx::serialization::output_archive& ar, unsigned)
121
    {
122
        // clang-format off
123
        // serialize base class
124
        ar & hpx::serialization::base_object<continuation>(*this);
48✔
125
        ar & f_;
48✔
126
        // clang-format on
127
    }
48✔
128

129
    void typed_continuation<void, util::unused_type>::trigger() const
82✔
130
    {
131
        LLCO_(info).format(
82✔
132
            "typed_continuation<void>::trigger({})", this->get_id());
133

134
        if (f_.empty())
82✔
135
        {
136
            if (!this->get_id())
137
            {
138
                HPX_THROW_EXCEPTION(hpx::error::invalid_status,
×
139
                    "typed_continuation<void>::trigger",
140
                    "attempt to trigger invalid LCO (the id is invalid)");
141
                return;
142
            }
143
            trigger_lco_event(this->get_id(), this->get_addr());
82✔
144
        }
145
        else
146
        {
147
            f_(this->get_id());
×
148
        }
149
    }
150

151
    typed_continuation<void, util::unused_type>::typed_continuation(
152
        hpx::id_type const& id)
153
      : continuation(id)
154
    {
155
    }
156

157
    typed_continuation<void, util::unused_type>::typed_continuation(
158
        hpx::id_type&& id) noexcept
159
      : continuation(HPX_MOVE(id))
160
    {
161
    }
162

163
    typed_continuation<void, util::unused_type>::typed_continuation(
164
        hpx::id_type const& id, naming::address&& addr)
165
      : continuation(id, HPX_MOVE(addr))
166
    {
167
    }
168

169
    typed_continuation<void, util::unused_type>::typed_continuation(
170
        hpx::id_type&& id, naming::address&& addr) noexcept
171
      : continuation(HPX_MOVE(id), HPX_MOVE(addr))
172
    {
173
    }
174

175
    typed_continuation<void, util::unused_type>::typed_continuation(
176
        typed_continuation&&) noexcept = default;
177
    typed_continuation<void, util::unused_type>& typed_continuation<void,
178
        util::unused_type>::operator=(typed_continuation&&) noexcept = default;
179

180
    void typed_continuation<void, util::unused_type>::trigger_value(
181
        util::unused_type&&) const
182
    {
183
        trigger();
184
    }
185

186
    void typed_continuation<void, util::unused_type>::trigger_value(
187
        util::unused_type const&) const
188
    {
189
        trigger();
190
    }
191
}    // namespace hpx::actions
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