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

STEllAR-GROUP / hpx / #867

15 Jan 2023 08:00PM UTC coverage: 86.487% (+0.5%) from 85.951%
#867

push

StellarBot
Merge #6135

6135: Fixing warnings reported by MSVC analysis r=hkaiser a=hkaiser

- adding MSVC specific #pragma's to suppress the benign warnings


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

120 of 120 new or added lines in 33 files covered. (100.0%)

174599 of 201880 relevant lines covered (86.49%)

1945607.64 hits per line

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

92.79
/libs/full/async_distributed/include/hpx/async_distributed/detail/post.hpp
1
//  Copyright (c) 2007-2022 Hartmut Kaiser
2
//  Copyright (c)      2011 Bryce Lelbach
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
#pragma once
9

10
#include <hpx/config.hpp>
11
#include <hpx/actions/post_helper.hpp>
12
#include <hpx/actions_base/action_priority.hpp>
13
#include <hpx/actions_base/actions_base_support.hpp>
14
#include <hpx/actions_base/traits/extract_action.hpp>
15
#include <hpx/actions_base/traits/is_continuation.hpp>
16
#include <hpx/actions_base/traits/is_distribution_policy.hpp>
17
#include <hpx/actions_base/traits/is_valid_action.hpp>
18
#include <hpx/assert.hpp>
19
#include <hpx/async_distributed/continuation.hpp>
20
#include <hpx/async_distributed/detail/post_implementations_fwd.hpp>
21
#include <hpx/async_distributed/put_parcel_fwd.hpp>
22
#include <hpx/async_local/post.hpp>
23
#include <hpx/components/client_base.hpp>
24
#include <hpx/components_base/agas_interface.hpp>
25
#include <hpx/components_base/traits/component_type_is_compatible.hpp>
26
#include <hpx/functional/traits/is_action.hpp>
27
#include <hpx/modules/threading_base.hpp>
28
#include <hpx/naming_base/address.hpp>
29
#include <hpx/naming_base/id_type.hpp>
30
#include <hpx/parcelset/detail/parcel_await.hpp>
31
#include <hpx/parcelset/parcelset_fwd.hpp>
32
#include <hpx/parcelset_base/parcel_interface.hpp>
33
#include <hpx/runtime_local/get_locality_id.hpp>
34

35
#include <type_traits>
36
#include <utility>
37

38
namespace hpx {
39

40
    ///////////////////////////////////////////////////////////////////////////
41
    // Invoked by a running HPX-thread to post() an action to any resource
42
    namespace detail {
43
#if defined(HPX_HAVE_NETWORKING)
44
        ///////////////////////////////////////////////////////////////////////
45
        template <typename Action>
46
        inline naming::address&& complement_addr(naming::address& addr)
469,690✔
47
        {
48
            if (components::component_invalid == addr.type_)
469,690✔
49
            {
50
                addr.type_ = components::get_component_type<
11,563✔
51
                    typename Action::component_type>();
52
            }
11,563✔
53
            return HPX_MOVE(addr);
469,690✔
54
        }
55

56
        template <typename Action, typename... Ts>
57
        inline bool put_parcel(hpx::id_type const& id, naming::address&& addr,
240,024✔
58
            threads::thread_priority priority, Ts&&... vs)
59
        {
60
            typedef
61
                typename hpx::traits::extract_action<Action>::type action_type;
62
            action_type act;
63

64
            parcelset::put_parcel(id, complement_addr<action_type>(addr), act,
455,759✔
65
                priority, HPX_FORWARD(Ts, vs)...);
215,735✔
66

67
            return false;    // destinations are remote
240,024✔
68
        }
69

70
        template <typename Action, typename Continuation, typename... Ts>
71
        inline bool put_parcel_cont(hpx::id_type const& id,
2,856✔
72
            naming::address&& addr, threads::thread_priority priority,
73
            Continuation&& cont, Ts&&... vs)
74
        {
75
            typedef
76
                typename hpx::traits::extract_action<Action>::type action_type;
77
            action_type act;
78

79
            parcelset::put_parcel(id, complement_addr<action_type>(addr),
5,712✔
80
                HPX_FORWARD(Continuation, cont), act, priority,
2,856✔
81
                HPX_FORWARD(Ts, vs)...);
2,856✔
82

83
            return false;    // destinations are remote
2,856✔
84
        }
85

86
        template <typename Action, typename... Ts>
87
        inline bool put_parcel_cb(hpx::id_type const& id,
88
            naming::address&& addr, threads::thread_priority priority,
89
            parcelset::write_handler_type const& cb, Ts&&... vs)
90
        {
91
            typedef
92
                typename hpx::traits::extract_action<Action>::type action_type;
93
            action_type act;
94

95
            parcelset::put_parcel_cb(cb, id, complement_addr<action_type>(addr),
96
                act, priority, HPX_FORWARD(Ts, vs)...);
97

98
            return false;    // destinations are remote
99
        }
100

101
        template <typename Action, typename... Ts>
102
        inline bool put_parcel_cb(hpx::id_type const& id,
7,533✔
103
            naming::address&& addr, threads::thread_priority priority,
104
            parcelset::write_handler_type&& cb, Ts&&... vs)
105
        {
106
            typedef
107
                typename hpx::traits::extract_action<Action>::type action_type;
108
            action_type act;
109

110
            parcelset::put_parcel_cb(HPX_MOVE(cb), id,
15,066✔
111
                complement_addr<action_type>(addr), act, priority,
7,533✔
112
                HPX_FORWARD(Ts, vs)...);
7,533✔
113

114
            return false;    // destinations are remote
7,533✔
115
        }
116

117
        template <typename Action, typename Continuation, typename... Ts>
118
        inline bool put_parcel_cont_cb(hpx::id_type const& id,
119
            naming::address&& addr, threads::thread_priority priority,
120
            Continuation&& cont, parcelset::write_handler_type const& cb,
121
            Ts&&... vs)
122
        {
123
            typedef
124
                typename hpx::traits::extract_action<Action>::type action_type;
125
            action_type act;
126

127
            parcelset::put_parcel_cb(cb, id, complement_addr<action_type>(addr),
128
                HPX_FORWARD(Continuation, cont), act, priority,
129
                HPX_FORWARD(Ts, vs)...);
130

131
            return false;    // destinations are remote
132
        }
133

134
        template <typename Action, typename Continuation, typename... Ts>
135
        inline bool put_parcel_cont_cb(hpx::id_type const& id,
219,136✔
136
            naming::address&& addr, threads::thread_priority priority,
137
            Continuation&& cont, parcelset::write_handler_type&& cb, Ts&&... vs)
138
        {
139
            typedef
140
                typename hpx::traits::extract_action<Action>::type action_type;
141
            action_type act;
142

143
            parcelset::put_parcel_cb(HPX_MOVE(cb), id,
438,272✔
144
                complement_addr<action_type>(addr),
219,136✔
145
                HPX_FORWARD(Continuation, cont), act, priority,
219,136✔
146
                HPX_FORWARD(Ts, vs)...);
186,303✔
147

148
            return false;    // destinations are remote
219,136✔
149
        }
150

151
        // We know it is remote.
152
        template <typename Action, typename... Ts>
153
        inline bool post_r_p(naming::address&& addr, hpx::id_type const& id,
240,024✔
154
            threads::thread_priority priority, Ts&&... vs)
155
        {
156
            // If remote, create a new parcel to be sent to the destination
157
            // Create a new parcel with the gid, action, and arguments
158
            return detail::put_parcel<Action>(
240,024✔
159
                id, HPX_MOVE(addr), priority, HPX_FORWARD(Ts, vs)...);
240,024✔
160
        }
161

162
        template <typename Action, typename... Ts>
163
        inline bool post_r(
164
            naming::address&& addr, hpx::id_type const& gid, Ts&&... vs)
165
        {
166
            return post_r_p<Action>(HPX_MOVE(addr), gid,
167
                actions::action_priority<Action>(), HPX_FORWARD(Ts, vs)...);
168
        }
169
#endif
170

171
        // We know it is local and has to be directly executed.
172
        template <typename Action, typename... Ts>
173
        inline bool post_l_p(hpx::id_type const& target, naming::address&& addr,
466,715✔
174
            threads::thread_priority priority, Ts&&... vs)
175
        {
176
            typedef
177
                typename hpx::traits::extract_action<Action>::type action_type;
178

179
            HPX_ASSERT(traits::component_type_is_compatible<
466,715✔
180
                typename action_type::component_type>::call(addr));
181

182
            threads::thread_init_data data;
466,713✔
183
#if defined(HPX_HAVE_THREAD_DESCRIPTION)
184
            data.description = actions::detail::get_action_name<Action>();
185
#endif
186
#if defined(HPX_HAVE_THREAD_PARENT_REFERENCE)
187
            data.parent_id = threads::get_self_id();
188
            data.parent_locality_id = get_locality_id();
189
#endif
190
#if defined(HPX_HAVE_APEX)
191
            data.timer_data = hpx::util::external_timer::new_task(
192
                data.description, data.parent_locality_id, data.parent_id);
193
#endif
194
            post_helper<action_type>::call(HPX_MOVE(data), target,
933,430✔
195
                addr.address_, addr.type_, priority, HPX_FORWARD(Ts, vs)...);
466,713✔
196
            return true;    // no parcel has been sent (dest is local)
197
        }
466,713✔
198

199
        // same as above, but taking all arguments by value
200
        template <typename Action, typename... Ts>
201
        inline bool post_l_p_val(hpx::id_type const& target,
202
            naming::address&& addr, threads::thread_priority priority, Ts... vs)
203
        {
204
            typedef
205
                typename hpx::traits::extract_action<Action>::type action_type;
206

207
            HPX_ASSERT(traits::component_type_is_compatible<
208
                typename action_type::component_type>::call(addr));
209

210
            threads::thread_init_data data;
211
#if defined(HPX_HAVE_THREAD_DESCRIPTION)
212
            data.description = actions::detail::get_action_name<Action>();
213
#endif
214
#if defined(HPX_HAVE_THREAD_PARENT_REFERENCE)
215
            data.parent_id = threads::get_self_id();
216
            data.parent_locality_id = get_locality_id();
217
#endif
218
#if defined(HPX_HAVE_APEX)
219
            data.timer_data = hpx::util::external_timer::new_task(
220
                data.description, data.parent_locality_id, data.parent_id);
221
#endif
222
            post_helper<action_type>::call(HPX_MOVE(data), target,
223
                addr.address_, addr.type_, priority, HPX_MOVE(vs)...);
224
            return true;    // no parcel has been sent (dest is local)
225
        }
226

227
        template <typename Action, typename... Ts>
228
        inline bool post_l(
×
229
            hpx::id_type const& target, naming::address&& addr, Ts&&... vs)
230
        {
231
            return post_l_p<Action>(target, HPX_MOVE(addr),
×
232
                actions::action_priority<Action>(), HPX_FORWARD(Ts, vs)...);
×
233
        }
234
    }    // namespace detail
235

236
    ///////////////////////////////////////////////////////////////////////////
237
    template <typename Action, typename... Ts>
238
    inline bool post_p(
35,463✔
239
        hpx::id_type const& id, threads::thread_priority priority, Ts&&... vs)
240
    {
241
        return hpx::detail::post_impl<Action>(
35,463✔
242
            id, priority, HPX_FORWARD(Ts, vs)...);
35,463✔
243
    }
244

245
    template <typename Action, typename Client, typename Stub, typename... Ts>
246
    inline bool post_p(components::client_base<Client, Stub> const& c,
247
        threads::thread_priority priority, Ts&&... vs)
248
    {
249
        // make sure the action is compatible with the component type
250
        typedef typename components::client_base<Client,
251
            Stub>::server_component_type component_type;
252

253
        typedef traits::is_valid_action<Action, component_type> is_valid;
254
        static_assert(is_valid::value,
255
            "The action to invoke is not supported by the target");
256

257
        return hpx::detail::post_impl<Action>(
258
            c.get_id(), priority, HPX_FORWARD(Ts, vs)...);
259
    }
260

261
    template <typename Action, typename DistPolicy, typename... Ts>
262
    inline std::enable_if_t<traits::is_distribution_policy<DistPolicy>::value,
263
        bool>
264
    post_p(
3✔
265
        DistPolicy const& policy, threads::thread_priority priority, Ts&&... vs)
266
    {
267
        return policy.template apply<Action>(priority, HPX_FORWARD(Ts, vs)...);
3✔
268
    }
269

270
    namespace detail {
271

272
        template <typename Action>
273
        struct post_dispatch<Action,
274
            std::enable_if_t<traits::is_action<Action>::value>>
275
        {
276
            template <typename Component, typename Signature, typename Derived,
277
                typename... Ts>
278
            HPX_FORCEINLINE static bool call(
24,597✔
279
                hpx::actions::basic_action<Component, Signature, Derived>,
280
                hpx::id_type const& id, Ts&&... ts)
281
            {
282
                return hpx::post_p<Derived>(id,
49,194✔
283
                    actions::action_priority<Derived>(),
24,597✔
284
                    HPX_FORWARD(Ts, ts)...);
24,595✔
285
            }
286

287
            template <typename Component, typename Signature, typename Derived,
288
                typename Client, typename Stub, typename... Ts>
289
            HPX_FORCEINLINE static bool call(
200✔
290
                hpx::actions::basic_action<Component, Signature, Derived>,
291
                components::client_base<Client, Stub> const& c, Ts&&... ts)
292
            {
293
                // make sure the action is compatible with the component type
294
                typedef typename components::client_base<Client,
295
                    Stub>::server_component_type component_type;
296

297
                typedef traits::is_valid_action<Derived, component_type>
298
                    is_valid;
299
                static_assert(is_valid::value,
300
                    "The action to invoke is not supported by the target");
301

302
                return hpx::post_p<Derived>(c.get_id(),
400✔
303
                    actions::action_priority<Derived>(),
200✔
304
                    HPX_FORWARD(Ts, ts)...);
200✔
305
            }
306

307
            template <typename Component, typename Signature, typename Derived,
308
                typename DistPolicy, typename... Ts>
309
            HPX_FORCEINLINE static std::enable_if_t<
310
                traits::is_distribution_policy<DistPolicy>::value, bool>
311
            call(hpx::actions::basic_action<Component, Signature, Derived>,
2✔
312
                DistPolicy const& policy, Ts&&... ts)
313
            {
314
                return hpx::post_p<Derived>(policy,
4✔
315
                    actions::action_priority<Derived>(),
2✔
316
                    HPX_FORWARD(Ts, ts)...);
2✔
317
            }
318
        };
319
    }    // namespace detail
320

321
    template <typename Action, typename... Ts>
322
    inline bool post(hpx::id_type const& id, Ts&&... vs)
10,666✔
323
    {
324
        return hpx::post_p<Action>(
10,666✔
325
            id, actions::action_priority<Action>(), HPX_FORWARD(Ts, vs)...);
10,666✔
326
    }
327

328
    template <typename Action, typename Client, typename Stub, typename... Ts>
329
    inline bool post(components::client_base<Client, Stub> const& c, Ts&&... vs)
×
330
    {
331
        // make sure the action is compatible with the component type
332
        typedef typename components::client_base<Client,
333
            Stub>::server_component_type component_type;
334

335
        typedef traits::is_valid_action<Action, component_type> is_valid;
336
        static_assert(is_valid::value,
337
            "The action to invoke is not supported by the target");
338

339
        return hpx::post_p<Action>(c.get_id(),
×
340
            actions::action_priority<Action>(), HPX_FORWARD(Ts, vs)...);
×
341
    }
342

343
    template <typename Action, typename DistPolicy, typename... Ts>
344
    inline std::enable_if_t<traits::is_distribution_policy<DistPolicy>::value,
345
        bool>
346
    post(DistPolicy const& policy, Ts&&... vs)
1✔
347
    {
348
        return hpx::post_p<Action>(
1✔
349
            policy, actions::action_priority<Action>(), HPX_FORWARD(Ts, vs)...);
1✔
350
    }
351

352
    ///////////////////////////////////////////////////////////////////////////
353
    namespace detail {
354
#if defined(HPX_HAVE_NETWORKING)
355
        template <typename Action, typename Continuation, typename... Ts>
356
        inline bool post_r_p(naming::address&& addr, Continuation&& c,
2,856✔
357
            hpx::id_type const& id, threads::thread_priority priority,
358
            Ts&&... vs)
359
        {
360
            // If remote, create a new parcel to be sent to the destination
361
            // Create a new parcel with the gid, action, and arguments
362
            return detail::put_parcel_cont<Action>(id, HPX_MOVE(addr), priority,
5,712✔
363
                HPX_FORWARD(Continuation, c), HPX_FORWARD(Ts, vs)...);
2,856✔
364
        }
365

366
        template <typename Action, typename Continuation, typename... Ts>
367
        inline std::enable_if_t<traits::is_continuation<Continuation>::value,
368
            bool>
369
        post_r(naming::address&& addr, Continuation&& c,
370
            hpx::id_type const& gid, Ts&&... vs)
371
        {
372
            return post_r_p<Action>(HPX_MOVE(addr),
373
                HPX_FORWARD(Continuation, c), gid,
374
                actions::action_priority<Action>(), HPX_FORWARD(Ts, vs)...);
375
        }
376

377
        template <typename Action>
378
        inline bool post_r_sync_p(naming::address&& addr,
141✔
379
            hpx::id_type const& id, threads::thread_priority priority)
380
        {
381
            typedef
382
                typename hpx::traits::extract_action<Action>::type action_type_;
383

384
            // If remote, create a new parcel to be sent to the destination
385
            // Create a new parcel with the gid, action, and arguments
386
            // Send the parcel through the parcel handler
387
            HPX_ASSERT(id.get_management_type() ==
141✔
388
                hpx::id_type::management_type::unmanaged);
389
            naming::gid_type gid = id.get_gid();
141✔
390
            parcelset::parcel p = parcelset::detail::create_parcel::call(
141✔
391
                HPX_MOVE(gid), complement_addr<action_type_>(addr),
141✔
392
                action_type_(), priority);
393

394
            parcelset::detail::parcel_await_apply(HPX_MOVE(p),
141✔
395
                parcelset::write_handler_type(), 0,
141✔
396
                [](parcelset::parcel&& p, parcelset::write_handler_type&&) {
282✔
397
                    hpx::parcelset::sync_put_parcel(HPX_MOVE(p));
141✔
398
                });
141✔
399

400
            return false;    // destination is remote
401
        }
141✔
402

403
        template <typename Action>
404
        inline bool post_r_sync(naming::address&& addr, hpx::id_type const& gid)
141✔
405
        {
406
            return post_r_sync_p<Action>(
141✔
407
                HPX_MOVE(addr), gid, actions::action_priority<Action>());
141✔
408
        }
409
#endif
410

411
        // We know it is local and has to be directly executed.
412
        template <typename Action, typename Continuation, typename... Ts>
413
        inline bool post_l_p(Continuation&& cont, hpx::id_type const& target,
399,332✔
414
            naming::address&& addr, threads::thread_priority priority,
415
            Ts&&... vs)
416
        {
417
            typedef
418
                typename hpx::traits::extract_action<Action>::type action_type;
419

420
            HPX_ASSERT(traits::component_type_is_compatible<
399,332✔
421
                typename action_type::component_type>::call(addr));
422

423
            threads::thread_init_data data;
399,332✔
424
#if defined(HPX_HAVE_THREAD_DESCRIPTION)
425
            data.description = actions::detail::get_action_name<Action>();
426
#endif
427
#if defined(HPX_HAVE_THREAD_PARENT_REFERENCE)
428
            data.parent_id = threads::get_self_id();
429
            data.parent_locality_id = get_locality_id();
430
#endif
431
#if defined(HPX_HAVE_APEX)
432
            data.timer_data = hpx::util::external_timer::new_task(
433
                data.description, data.parent_locality_id, data.parent_id);
434
#endif
435
            post_helper<action_type>::call(HPX_MOVE(data),
399,332✔
436
                HPX_FORWARD(Continuation, cont), target, addr.address_,
399,332✔
437
                addr.type_, priority, HPX_FORWARD(Ts, vs)...);
399,332✔
438
            return true;    // no parcel has been sent (dest is local)
439
        }
399,332✔
440

441
        template <typename Action, typename Continuation, typename... Ts>
442
        inline std::enable_if_t<traits::is_continuation<Continuation>::value,
443
            bool>
444
        post_l(Continuation&& c, hpx::id_type const& target,
445
            naming::address& addr, Ts&&... vs)
446
        {
447
            return post_l_p<Action>(HPX_FORWARD(Continuation, c), target,
448
                HPX_MOVE(addr), actions::action_priority<Action>(),
449
                HPX_FORWARD(Ts, vs)...);
450
        }
451
    }    // namespace detail
452

453
    ///////////////////////////////////////////////////////////////////////////
454
    template <typename Action, typename Continuation, typename... Ts>
455
    inline std::enable_if_t<traits::is_continuation<Continuation>::value, bool>
456
    post_p(Continuation&& c, hpx::id_type const& gid,
23,961✔
457
        threads::thread_priority priority, Ts&&... vs)
458
    {
459
        return hpx::detail::post_impl<Action>(HPX_FORWARD(Continuation, c), gid,
47,922✔
460
            priority, HPX_FORWARD(Ts, vs)...);
23,961✔
461
    }
462

463
    template <typename Action, typename Continuation, typename Client,
464
        typename Stub, typename... Ts>
465
    inline std::enable_if_t<traits::is_continuation<Continuation>::value, bool>
466
    post_p(Continuation&& cont, components::client_base<Client, Stub> const& c,
467
        threads::thread_priority priority, Ts&&... vs)
468
    {
469
        // make sure the action is compatible with the component type
470
        typedef typename components::client_base<Client,
471
            Stub>::server_component_type component_type;
472

473
        typedef traits::is_valid_action<Action, component_type> is_valid;
474
        static_assert(is_valid::value,
475
            "The action to invoke is not supported by the target");
476

477
        return hpx::detail::post_impl<Action>(HPX_FORWARD(Continuation, cont),
478
            c.get_id(), priority, HPX_FORWARD(Ts, vs)...);
479
    }
480

481
    template <typename Action, typename Continuation, typename DistPolicy,
482
        typename... Ts>
483
    inline std::enable_if_t<traits::is_continuation<Continuation>::value &&
484
            traits::is_distribution_policy<DistPolicy>::value,
485
        bool>
486
    post_p(Continuation&& c, DistPolicy const& policy,
9✔
487
        threads::thread_priority priority, Ts&&... vs)
488
    {
489
        return policy.template apply<Action>(
18✔
490
            HPX_FORWARD(Continuation, c), priority, HPX_FORWARD(Ts, vs)...);
9✔
491
    }
492

493
    namespace detail {
494

495
        template <typename Continuation>
496
        struct post_dispatch<Continuation,
497
            std::enable_if_t<traits::is_continuation<Continuation>::value>>
498
        {
499
            template <typename Component, typename Signature, typename Derived,
500
                typename... Ts>
501
            HPX_FORCEINLINE static bool call(Continuation&& c,
502
                hpx::actions::basic_action<Component, Signature, Derived>,
503
                hpx::id_type const& id, Ts&&... ts)
504
            {
505
                return hpx::post_p<Derived>(HPX_FORWARD(Continuation, c), id,
506
                    actions::action_priority<Derived>(),
507
                    HPX_FORWARD(Ts, ts)...);
508
            }
509

510
            template <typename Continuation_, typename Component,
511
                typename Signature, typename Derived, typename Client,
512
                typename Stub, typename... Ts>
513
            HPX_FORCEINLINE static bool call(Continuation_&& cont,
514
                hpx::actions::basic_action<Component, Signature, Derived>,
515
                components::client_base<Client, Stub> const& c, Ts&&... ts)
516
            {
517
                // make sure the action is compatible with the component type
518
                typedef typename components::client_base<Client,
519
                    Stub>::server_component_type component_type;
520

521
                typedef traits::is_valid_action<Derived, component_type>
522
                    is_valid;
523
                static_assert(is_valid::value,
524
                    "The action to invoke is not supported by the target");
525

526
                return hpx::post_p<Derived>(HPX_FORWARD(Continuation, cont),
527
                    c.get_id(), actions::action_priority<Derived>(),
528
                    HPX_FORWARD(Ts, ts)...);
529
            }
530

531
            template <typename Component, typename Signature, typename Derived,
532
                typename DistPolicy, typename... Ts>
533
            HPX_FORCEINLINE static std::enable_if_t<
534
                traits::is_distribution_policy<DistPolicy>::value, bool>
535
            call(Continuation&& c,
536
                hpx::actions::basic_action<Component, Signature, Derived>,
537
                DistPolicy const& policy, Ts&&... ts)
538
            {
539
                return hpx::post_p<Derived>(HPX_FORWARD(Continuation, c),
540
                    policy, actions::action_priority<Derived>(),
541
                    HPX_FORWARD(Ts, ts)...);
542
            }
543
        };
544
    }    // namespace detail
545

546
    template <typename Action, typename Continuation, typename... Ts>
547
    inline std::enable_if_t<traits::is_continuation<Continuation>::value, bool>
548
    post(Continuation&& c, hpx::id_type const& gid, Ts&&... vs)
12,008✔
549
    {
550
        return hpx::post_p<Action>(HPX_FORWARD(Continuation, c), gid,
24,016✔
551
            actions::action_priority<Action>(), HPX_FORWARD(Ts, vs)...);
12,008✔
552
    }
553

554
    template <typename Action, typename Continuation, typename Client,
555
        typename Stub, typename... Ts>
556
    inline std::enable_if_t<traits::is_continuation<Continuation>::value, bool>
557
    post(Continuation&& cont, components::client_base<Client, Stub> const& c,
558
        Ts&&... vs)
559
    {
560
        // make sure the action is compatible with the component type
561
        typedef typename components::client_base<Client,
562
            Stub>::server_component_type component_type;
563

564
        typedef traits::is_valid_action<Action, component_type> is_valid;
565
        static_assert(is_valid::value,
566
            "The action to invoke is not supported by the target");
567

568
        return hpx::post_p<Action>(HPX_FORWARD(Continuation, cont), c.get_id(),
569
            actions::action_priority<Action>(), HPX_FORWARD(Ts, vs)...);
570
    }
571

572
    template <typename Action, typename Continuation, typename DistPolicy,
573
        typename... Ts>
574
    inline std::enable_if_t<traits::is_distribution_policy<DistPolicy>::value &&
575
            traits::is_continuation<Continuation>::value,
576
        bool>
577
    post(Continuation&& c, DistPolicy const& policy, Ts&&... vs)
9✔
578
    {
579
        return hpx::post_p<Action>(HPX_FORWARD(Continuation, c), policy,
18✔
580
            actions::action_priority<Action>(), HPX_FORWARD(Ts, vs)...);
9✔
581
    }
582

583
    ///////////////////////////////////////////////////////////////////////////
584
#if defined(HPX_HAVE_NETWORKING)
585
    namespace detail {
586

587
        template <typename Action, typename... Ts>
588
        inline bool post_c_p(naming::address&& addr,
589
            hpx::id_type const& contgid, hpx::id_type const& gid,
590
            threads::thread_priority priority, Ts&&... vs)
591
        {
592
            typedef
593
                typename hpx::traits::extract_action<Action>::local_result_type
594
                    local_result_type;
595
            typedef
596
                typename hpx::traits::extract_action<Action>::remote_result_type
597
                    remote_result_type;
598

599
            return post_r_p<Action>(HPX_MOVE(addr),
600
                actions::typed_continuation<local_result_type,
601
                    remote_result_type>(contgid),
602
                gid, priority, HPX_FORWARD(Ts, vs)...);
603
        }
604

605
        template <typename Action, typename... Ts>
606
        inline bool post_c(naming::address&& addr, hpx::id_type const& contgid,
607
            hpx::id_type const& gid, Ts&&... vs)
608
        {
609
            typedef
610
                typename hpx::traits::extract_action<Action>::local_result_type
611
                    local_result_type;
612
            typedef
613
                typename hpx::traits::extract_action<Action>::remote_result_type
614
                    remote_result_type;
615

616
            return post_r_p<Action>(HPX_MOVE(addr),
617
                actions::typed_continuation<local_result_type,
618
                    remote_result_type>(contgid),
619
                gid, actions::action_priority<Action>(),
620
                HPX_FORWARD(Ts, vs)...);
621
        }
622
    }    // namespace detail
623
#endif
624

625
    ///////////////////////////////////////////////////////////////////////////
626
    template <typename Action, typename... Ts>
627
    inline bool post_c_p(hpx::id_type const& contgid, hpx::id_type const& gid,
628
        threads::thread_priority priority, Ts&&... vs)
629
    {
630
        typedef typename hpx::traits::extract_action<Action>::local_result_type
631
            local_result_type;
632
        typedef typename hpx::traits::extract_action<Action>::remote_result_type
633
            remote_result_type;
634

635
        return hpx::post_p<Action>(
636
            actions::typed_continuation<local_result_type, remote_result_type>(
637
                contgid),
638
            gid, priority, HPX_FORWARD(Ts, vs)...);
639
    }
640

641
    template <typename Action, typename... Ts>
642
    inline bool post_c(
11,932✔
643
        hpx::id_type const& contgid, hpx::id_type const& gid, Ts&&... vs)
644
    {
645
        typedef typename hpx::traits::extract_action<Action>::local_result_type
646
            local_result_type;
647
        typedef typename hpx::traits::extract_action<Action>::remote_result_type
648
            remote_result_type;
649

650
        return hpx::post_p<Action>(
11,932✔
651
            actions::typed_continuation<local_result_type, remote_result_type>(
11,932✔
652
                contgid),
11,932✔
653
            gid, actions::action_priority<Action>(), HPX_FORWARD(Ts, vs)...);
11,932✔
654
    }
×
655

656
    template <typename Component, typename Signature, typename Derived,
657
        typename... Ts>
658
    inline bool post_c(
21✔
659
        hpx::actions::basic_action<Component, Signature, Derived> /*act*/,
660
        hpx::id_type const& contgid, hpx::id_type const& gid, Ts&&... vs)
661
    {
662
        typedef typename hpx::traits::extract_action<Derived>::local_result_type
663
            local_result_type;
664
        typedef
665
            typename hpx::traits::extract_action<Derived>::remote_result_type
666
                remote_result_type;
667

668
        return hpx::post_p<Derived>(
21✔
669
            actions::typed_continuation<local_result_type, remote_result_type>(
21✔
670
                contgid),
21✔
671
            gid, actions::action_priority<Derived>(), HPX_FORWARD(Ts, vs)...);
21✔
672
    }
×
673

674
    ///////////////////////////////////////////////////////////////////////////
675
    template <typename Action, typename... Ts>
676
    HPX_DEPRECATED_V(1, 9, "hpx::apply is deprecated, use hpx::post instead")
677
    inline bool apply(Ts&&... ts)
678
    {
679
        return hpx::post<Action>(HPX_FORWARD(Ts, ts)...);
680
    }
681

682
    template <typename... Ts>
683
    HPX_DEPRECATED_V(1, 9, "hpx::apply is deprecated, use hpx::post instead")
684
    inline bool apply(Ts&&... ts)
685
    {
686
        return hpx::post(HPX_FORWARD(Ts, ts)...);
687
    }
688

689
    template <typename Action, typename... Ts>
690
    HPX_DEPRECATED_V(
691
        1, 9, "hpx::apply_p is deprecated, use hpx::post_p instead")
692
    inline bool apply_p(Ts&&... ts)
693
    {
694
        return hpx::post_p<Action>(HPX_FORWARD(Ts, ts)...);
695
    }
696

697
    template <typename... Ts>
698
    HPX_DEPRECATED_V(
699
        1, 9, "hpx::apply_p is deprecated, use hpx::post_p instead")
700
    inline bool apply_p(Ts&&... ts)
701
    {
702
        return hpx::post_p(HPX_FORWARD(Ts, ts)...);
703
    }
704

705
    template <typename Action, typename... Ts>
706
    HPX_DEPRECATED_V(
707
        1, 9, "hpx::apply_c is deprecated, use hpx::post_c instead")
708
    inline bool apply_c(Ts&&... ts)
709
    {
710
        return hpx::post_c<Action>(HPX_FORWARD(Ts, ts)...);
711
    }
712

713
    template <typename... Ts>
714
    HPX_DEPRECATED_V(
715
        1, 9, "hpx::apply_c is deprecated, use hpx::post_c instead")
716
    inline bool apply_c(Ts&&... ts)
717
    {
718
        return hpx::post_c(HPX_FORWARD(Ts, ts)...);
719
    }
720

721
    template <typename Action, typename... Ts>
722
    HPX_DEPRECATED_V(
723
        1, 9, "hpx::apply_c_p is deprecated, use hpx::post_c_p instead")
724
    inline bool apply_c_p(Ts&&... ts)
725
    {
726
        return hpx::post_c_p<Action>(HPX_FORWARD(Ts, ts)...);
727
    }
728

729
    template <typename... Ts>
730
    HPX_DEPRECATED_V(
731
        1, 9, "hpx::apply_c_p is deprecated, use hpx::post_c_p instead")
732
    inline bool apply_c_p(Ts&&... ts)
733
    {
734
        return hpx::post_c_p(HPX_FORWARD(Ts, ts)...);
735
    }
736
}    // namespace hpx
737

738
// these files are intentionally #included last as it refers to functions
739
// defined here
740
#include <hpx/async_distributed/detail/post_implementations.hpp>
741
#include <hpx/async_distributed/put_parcel.hpp>
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