• 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

9.52
/libs/full/async_distributed/src/trigger_lco.cpp
1
//  Copyright (c) 2007-2024 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/assert.hpp>
8
#include <hpx/async_distributed/base_lco.hpp>
9
#include <hpx/async_distributed/post.hpp>
10
#include <hpx/async_distributed/trigger_lco.hpp>
11

12
#include <hpx/naming_base/address.hpp>
13
#include <hpx/naming_base/id_type.hpp>
14
#if defined(HPX_MSVC) && !defined(HPX_DEBUG)
15
#include <hpx/async_distributed/base_lco_with_value.hpp>
16
#endif
17

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

21
#include <hpx/config/warnings_prefix.hpp>
22

23
namespace hpx {
24

82✔
25
    void trigger_lco_event([[maybe_unused]] hpx::id_type id,
26
        [[maybe_unused]] naming::address&& addr,
27
        [[maybe_unused]] bool move_credits)
28
    {
29
#if !defined(HPX_COMPUTE_DEVICE_CODE)
164✔
30
        using set_action = lcos::base_lco::set_event_action;
31

32
        constexpr launch::async_policy policy(
33
            actions::action_priority<set_action>(),
34
            actions::action_stacksize<set_action>());
×
35
        if (move_credits &&
36
            id.get_management_type() !=
37
                hpx::id_type::management_type::unmanaged)
×
38
        {
39
            hpx::id_type const target(
40
                id.get_gid(), id_type::management_type::managed_move_credit);
41
            id.make_unmanaged();
42

82✔
43
            detail::post_impl<set_action>(target, HPX_MOVE(addr), policy);
44
        }
45
        else
46
        {
47
            detail::post_impl<set_action>(id, HPX_MOVE(addr), policy);
48
        }
49
#else
50
        HPX_ASSERT(false);
51
#endif
82✔
52
    }
53

×
54
    void trigger_lco_event([[maybe_unused]] hpx::id_type id,
55
        [[maybe_unused]] naming::address&& addr,
56
        [[maybe_unused]] hpx::id_type const& cont,
57
        [[maybe_unused]] bool move_credits)
58
    {
59
#if !defined(HPX_COMPUTE_DEVICE_CODE)
60
        using set_action = lcos::base_lco::set_event_action;
61
        using local_result_type =
62
            hpx::traits::extract_action<set_action>::local_result_type;
×
63
        using remote_result_type =
64
            hpx::traits::extract_action<set_action>::remote_result_type;
65

66
        constexpr launch::async_policy policy(
67
            actions::action_priority<set_action>(),
×
68
            actions::action_stacksize<set_action>());
69
        if (move_credits &&
70
            id.get_management_type() !=
×
71
                hpx::id_type::management_type::unmanaged)
×
72
        {
73
            hpx::id_type const target(
74
                id.get_gid(), id_type::management_type::managed_move_credit);
75
            id.make_unmanaged();
76

77
            detail::post_impl<set_action>(
×
78
                actions::typed_continuation<local_result_type,
×
79
                    remote_result_type>(cont),
80
                target, HPX_MOVE(addr), policy);
81
        }
82
        else
83
        {
84
            detail::post_impl<set_action>(
85
                actions::typed_continuation<local_result_type,
86
                    remote_result_type>(cont),
87
                id, HPX_MOVE(addr), policy);
88
        }
89
#else
×
90
        HPX_ASSERT(false);
91
#endif
×
92
    }
93

94
    void set_lco_error([[maybe_unused]] hpx::id_type id,
95
        [[maybe_unused]] naming::address&& addr,
96
        [[maybe_unused]] std::exception_ptr const& e,
×
97
        [[maybe_unused]] bool move_credits)
98
    {
99
#if !defined(HPX_COMPUTE_DEVICE_CODE)
100
        using set_action = lcos::base_lco::set_exception_action;
101

×
102
        constexpr launch::async_policy policy(
103
            actions::action_priority<set_action>(),
104
            actions::action_stacksize<set_action>());
×
105
        if (move_credits &&
106
            id.get_management_type() !=
107
                hpx::id_type::management_type::unmanaged)
108
        {
109
            hpx::id_type const target(
×
110
                id.get_gid(), id_type::management_type::managed_move_credit);
111
            id.make_unmanaged();
112

113
            detail::post_impl<set_action>(target, HPX_MOVE(addr), policy, e);
114
        }
115
        else
116
        {
117
            detail::post_impl<set_action>(id, HPX_MOVE(addr), policy, e);
118
        }
119
#else
×
120
        HPX_ASSERT(false);
121
#endif
×
122
    }
123

124
    void set_lco_error([[maybe_unused]] hpx::id_type id,
125
        [[maybe_unused]] naming::address&& addr,
126
        [[maybe_unused]] std::exception_ptr&& e,
127
        [[maybe_unused]] bool move_credits)
×
128
    {
129
#if !defined(HPX_COMPUTE_DEVICE_CODE)
130
        using set_action = lcos::base_lco::set_exception_action;
131

132
        constexpr launch::async_policy policy(
×
133
            actions::action_priority<set_action>(),
134
            actions::action_stacksize<set_action>());
135
        if (move_credits &&
×
136
            id.get_management_type() !=
137
                hpx::id_type::management_type::unmanaged)
138
        {
139
            hpx::id_type const target(
140
                id.get_gid(), id_type::management_type::managed_move_credit);
×
141
            id.make_unmanaged();
142

143
            detail::post_impl<set_action>(
144
                target, HPX_MOVE(addr), policy, HPX_MOVE(e));
145
        }
146
        else
147
        {
148
            detail::post_impl<set_action>(
149
                id, HPX_MOVE(addr), policy, HPX_MOVE(e));
150
        }
×
151
#else
152
        HPX_ASSERT(false);
×
153
#endif
154
    }
155

156
    void set_lco_error([[maybe_unused]] hpx::id_type id,
157
        [[maybe_unused]] naming::address&& addr,
158
        [[maybe_unused]] std::exception_ptr const& e,
159
        [[maybe_unused]] hpx::id_type const& cont,
160
        [[maybe_unused]] bool move_credits)
161
    {
162
#if !defined(HPX_COMPUTE_DEVICE_CODE)
×
163
        using set_action = lcos::base_lco::set_exception_action;
164
        using local_result_type =
165
            hpx::traits::extract_action<set_action>::local_result_type;
166
        using remote_result_type =
167
            hpx::traits::extract_action<set_action>::remote_result_type;
×
168

169
        constexpr launch::async_policy policy(
170
            actions::action_priority<set_action>(),
×
171
            actions::action_stacksize<set_action>());
×
172
        if (move_credits &&
173
            id.get_management_type() !=
174
                hpx::id_type::management_type::unmanaged)
175
        {
176
            hpx::id_type const target(
177
                id.get_gid(), id_type::management_type::managed_move_credit);
178
            id.make_unmanaged();
×
179

×
180
            detail::post_impl<set_action>(
181
                actions::typed_continuation<local_result_type,
182
                    remote_result_type>(cont),
183
                target, HPX_MOVE(addr), policy, e);
184
        }
185
        else
186
        {
187
            detail::post_impl<set_action>(
188
                actions::typed_continuation<local_result_type,
189
                    remote_result_type>(cont),
190
                id, HPX_MOVE(addr), policy, e);
191
        }
×
192
#else
193
        HPX_ASSERT(false);
×
194
#endif
195
    }
196

197
    void set_lco_error([[maybe_unused]] hpx::id_type id,
198
        [[maybe_unused]] naming::address&& addr,
199
        [[maybe_unused]] std::exception_ptr&& e,
200
        [[maybe_unused]] hpx::id_type const& cont,
201
        [[maybe_unused]] bool move_credits)
202
    {
203
#if !defined(HPX_COMPUTE_DEVICE_CODE)
×
204
        using set_action = lcos::base_lco::set_exception_action;
205
        using local_result_type =
206
            hpx::traits::extract_action<set_action>::local_result_type;
207
        using remote_result_type =
208
            hpx::traits::extract_action<set_action>::remote_result_type;
×
209

210
        constexpr launch::async_policy policy(
211
            actions::action_priority<set_action>(),
×
212
            actions::action_stacksize<set_action>());
×
213
        if (move_credits &&
214
            id.get_management_type() !=
215
                hpx::id_type::management_type::unmanaged)
216
        {
217
            hpx::id_type const target(
218
                id.get_gid(), id_type::management_type::managed_move_credit);
219
            id.make_unmanaged();
×
220

×
221
            detail::post_impl<set_action>(
222
                actions::typed_continuation<local_result_type,
223
                    remote_result_type>(cont),
224
                target, HPX_MOVE(addr), policy, HPX_MOVE(e));
225
        }
226
        else
227
        {
228
            detail::post_impl<set_action>(
229
                actions::typed_continuation<local_result_type,
230
                    remote_result_type>(cont),
231
                id, HPX_MOVE(addr), policy, HPX_MOVE(e));
232
        }
233
#else
×
234
        HPX_ASSERT(false);
235
#endif
236
    }
237

238
#if defined(HPX_MSVC) && !defined(HPX_DEBUG)
239
    ///////////////////////////////////////////////////////////////////////////
240
    // Explicitly instantiate specific post needed for set_lco_value for MSVC
241
    // (in release mode only, leads to missing symbols otherwise).
242
    template bool post<lcos::base_lco_with_value<util::unused_type,
243
                           util::unused_type>::set_value_action,
244
        util::unused_type>(hpx::id_type const&, util::unused_type&&);
245
#endif
246
}    // namespace hpx
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