-
-
Notifications
You must be signed in to change notification settings - Fork 421
/
basic_action.hpp
1123 lines (1019 loc) · 46.3 KB
/
basic_action.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Copyright (c) 2007-2018 Hartmut Kaiser
// Copyright (c) 2011 Bryce Lelbach
// Copyright (c) 2011 Thomas Heller
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
/// \file hpx/runtime/actions/basic_action.hpp
#ifndef HPX_RUNTIME_ACTIONS_BASIC_ACTION_HPP
#define HPX_RUNTIME_ACTIONS_BASIC_ACTION_HPP
#include <hpx/config.hpp>
#include <hpx/exception.hpp>
#include <hpx/runtime/actions/action_support.hpp>
#include <hpx/runtime/actions/transfer_action.hpp>
#include <hpx/runtime/actions/transfer_continuation_action.hpp>
#include <hpx/runtime/actions/basic_action_fwd.hpp>
#include <hpx/runtime/actions/continuation.hpp>
#include <hpx/runtime/actions/detail/action_factory.hpp>
#include <hpx/runtime/actions/detail/invocation_count_registry.hpp>
#include <hpx/runtime/parcelset/detail/per_action_data_counter_registry.hpp>
#include <hpx/runtime/launch_policy.hpp>
#include <hpx/runtime/naming/address.hpp>
#include <hpx/runtime/naming/id_type.hpp>
#include <hpx/runtime/threads/thread_data_fwd.hpp>
#include <hpx/runtime/threads/thread_enums.hpp>
#include <hpx/runtime_fwd.hpp>
#include <hpx/traits/action_decorate_function.hpp>
#include <hpx/traits/action_priority.hpp>
#include <hpx/traits/action_remote_result.hpp>
#include <hpx/traits/action_stacksize.hpp>
#include <hpx/traits/is_action.hpp>
#include <hpx/traits/is_distribution_policy.hpp>
#include <hpx/traits/is_future.hpp>
#include <hpx/traits/promise_local_result.hpp>
#include <hpx/util/bind.hpp>
#include <hpx/util/detail/pp/cat.hpp>
#include <hpx/util/detail/pp/expand.hpp>
#include <hpx/util/detail/pp/nargs.hpp>
#include <hpx/util/detail/pp/stringize.hpp>
#include <hpx/util/detail/pack.hpp>
#include <hpx/util/get_and_reset_value.hpp>
#include <hpx/util/logging.hpp>
#include <hpx/util/tuple.hpp>
#if HPX_HAVE_ITTNOTIFY != 0 && !defined(HPX_HAVE_APEX)
#include <hpx/util/itt_notify.hpp>
#endif
#include <atomic>
#include <cstddef>
#include <cstdint>
#include <exception>
#include <memory>
#include <sstream>
#include <string>
#include <type_traits>
#include <utility>
namespace hpx { namespace actions
{
/// \cond NOINTERNAL
///////////////////////////////////////////////////////////////////////////
namespace detail
{
template <typename Action, typename F, typename ...Ts>
struct continuation_thread_function
{
public:
typedef typename Action::continuation_type continuation_type;
explicit continuation_thread_function(
continuation_type&& cont,
naming::address::address_type lva,
F&& f, Ts&&... vs)
: cont_(std::move(cont))
, lva_(lva)
, f_(std::forward<F>(f), std::forward<Ts>(vs)...)
{}
explicit continuation_thread_function(
naming::id_type target,
continuation_type&& cont,
naming::address::address_type lva,
F&& f, Ts&&... vs)
: target_(std::move(target))
, cont_(std::move(cont))
, lva_(lva)
, f_(std::forward<F>(f), std::forward<Ts>(vs)...)
{}
continuation_thread_function(continuation_thread_function && other)
: cont_(std::move(other.cont_))
, lva_(std::move(other.lva_))
, f_(std::move(other.f_))
{}
HPX_FORCEINLINE threads::thread_result_type
operator()(threads::thread_state_ex_enum)
{
LTM_(debug)
<< "Executing " << Action::get_action_name(lva_)
<< " with continuation(" << cont_.get_id() << ")";
actions::trigger(std::move(cont_), f_);
return threads::thread_result_type(threads::terminated,
threads::invalid_thread_id);
}
private:
// This holds the target alive, if necessary.
naming::id_type target_;
continuation_type cont_;
naming::address::address_type lva_;
util::detail::deferred<
typename std::decay<F>::type,
typename std::decay<Ts>::type...> f_;
};
///////////////////////////////////////////////////////////////////////
template <typename T>
struct is_non_const_reference
: std::integral_constant<bool,
std::is_lvalue_reference<T>::value &&
!std::is_const<typename std::remove_reference<T>::type>::value
>
{};
}
template <typename Component, typename R, typename ...Args, typename Derived>
struct basic_action<Component, R(Args...), Derived>
{
// Flag the use of raw pointer types as action arguments
static_assert(
!util::detail::any_of<std::is_pointer<Args>...>::value,
"Using raw pointers as arguments for actions is not supported.");
// Flag the use of array types as action arguments
static_assert(
!util::detail::any_of<
std::is_array<typename std::remove_reference<Args>::type>...
>::value,
"Using arrays as arguments for actions is not supported.");
// Flag the use of non-const reference types as action arguments
static_assert(
!util::detail::any_of<
detail::is_non_const_reference<Args>...
>::value,
"Using non-const references as arguments for actions is not supported.");
typedef Component component_type;
typedef Derived derived_type;
// result_type represents the type returned when invoking operator()
typedef typename traits::promise_local_result<R>::type result_type;
// The remote_result_type is the remote type for the type_continuation
typedef typename traits::action_remote_result<R>::type remote_result_type;
// The local_result_type is the local type for the type_continuation
typedef
typename traits::promise_local_result<
remote_result_type
>::type local_result_type;
typedef
hpx::actions::typed_continuation<
local_result_type,
remote_result_type
> continuation_type;
static const std::size_t arity = sizeof...(Args);
typedef util::tuple<typename std::decay<Args>::type...> arguments_type;
typedef void action_tag;
///////////////////////////////////////////////////////////////////////
static std::string get_action_name(naming::address::address_type /*lva*/)
{
std::stringstream name;
name << "action(" << detail::get_action_name<Derived>() << ")";
return name.str();
}
template <typename ...Ts>
static R invoke(naming::address::address_type /*lva*/,
naming::address::component_type /*comptype*/, Ts&&... /*vs*/);
struct invoker
{
typedef
typename std::conditional<
std::is_void<R>::value, util::unused_type, R
>::type
result_type;
template <typename ...Ts>
HPX_FORCEINLINE result_type operator()(
naming::address::address_type lva,
naming::address::component_type comptype, Ts&&... vs) const
{
return invoke(
typename std::is_void<R>::type(), lva, comptype,
std::forward<Ts>(vs)...);
}
private:
template <typename ...Ts>
HPX_FORCEINLINE result_type invoke(std::true_type,
naming::address::address_type lva,
naming::address::component_type comptype, Ts&&... vs) const
{
Derived::invoke(lva, comptype, std::forward<Ts>(vs)...);
return util::unused;
}
template <typename ...Ts>
HPX_FORCEINLINE result_type invoke(std::false_type,
naming::address::address_type lva,
naming::address::component_type comptype, Ts&&... vs) const
{
return Derived::invoke(lva, comptype, std::forward<Ts>(vs)...);
}
};
protected:
/// The \a thread_function will be registered as the thread
/// function of a thread. It encapsulates the execution of the
/// original function (given by \a func).
struct thread_function
{
thread_function()
{}
thread_function(naming::id_type const& target)
: target_(target)
{}
template <typename ...Ts>
HPX_FORCEINLINE threads::thread_result_type
operator()(naming::address::address_type lva,
naming::address::component_type comptype, Ts&&... vs) const
{
try {
LTM_(debug) << "Executing "
<< Derived::get_action_name(lva) << ".";
// call the function, ignoring the return value
Derived::invoke(lva, comptype, std::forward<Ts>(vs)...);
}
catch (hpx::thread_interrupted const&) { //-V565
/* swallow this exception */
}
catch (std::exception const& e) {
LTM_(error)
<< "Unhandled exception while executing "
<< Derived::get_action_name(lva) << ": " << e.what();
// report this error to the console in any case
hpx::report_error(std::current_exception());
}
catch (...) {
LTM_(error)
<< "Unhandled exception while executing "
<< Derived::get_action_name(lva);
// report this error to the console in any case
hpx::report_error(std::current_exception());
}
// Verify that there are no more registered locks for this
// OS-thread. This will throw if there are still any locks
// held.
util::force_error_on_lock();
return threads::thread_result_type(threads::terminated,
threads::invalid_thread_id);
}
// This holds the target alive, if necessary.
naming::id_type target_;
};
public:
// This static construct_thread_function allows to construct
// a proper thread function for a thread without having to
// instantiate the base_action type. This is used by the applier in
// case no continuation has been supplied.
template <typename ...Ts>
static threads::thread_function_type
construct_thread_function(naming::id_type const& target,
naming::address::address_type lva,
naming::address::component_type comptype, Ts&&... vs)
{
if (target &&
target.get_management_type() == naming::id_type::unmanaged)
{
return traits::action_decorate_function<Derived>::call(lva,
util::bind(util::one_shot(
typename Derived::thread_function()),
lva, comptype, std::forward<Ts>(vs)...));
}
return traits::action_decorate_function<Derived>::call(lva,
util::bind(util::one_shot(
typename Derived::thread_function(target)),
lva, comptype, std::forward<Ts>(vs)...));
}
// This static construct_thread_function allows to construct
// a proper thread function for a thread without having to
// instantiate the base_action type. This is used by the applier in
// case a continuation has been supplied
template <typename ...Ts>
static threads::thread_function_type
construct_thread_function(naming::id_type const& target,
continuation_type&& cont, naming::address::address_type lva,
naming::address::component_type comptype, Ts&&... vs)
{
typedef detail::continuation_thread_function<
Derived, invoker, naming::address::address_type&,
naming::address::component_type&, Ts&&...
> thread_function;
if (target &&
target.get_management_type() == naming::id_type::unmanaged)
{
return traits::action_decorate_function<Derived>::call(lva,
thread_function(std::move(cont), lva, invoker(),
lva, comptype, std::forward<Ts>(vs)...));
}
return traits::action_decorate_function<Derived>::call(lva,
thread_function(target, std::move(cont), lva, invoker(),
lva, comptype, std::forward<Ts>(vs)...));
}
// direct execution
template <typename ...Ts>
static HPX_FORCEINLINE
typename invoker::result_type
execute_function(naming::address::address_type lva,
naming::address::component_type comptype, Ts&&... vs)
{
LTM_(debug)
<< "basic_action::execute_function"
<< Derived::get_action_name(lva);
return invoker()(lva, comptype, std::forward<Ts>(vs)...);
}
private:
///////////////////////////////////////////////////////////////////////
struct sync_invoke
{
template <typename IdOrPolicy, typename Policy, typename ...Ts>
HPX_FORCEINLINE static result_type call(
Policy const& policy, IdOrPolicy const& id_or_policy,
error_code& ec, Ts&&... vs)
{
return hpx::async<basic_action>(policy, id_or_policy,
std::forward<Ts>(vs)...).get(ec);
}
};
public:
///////////////////////////////////////////////////////////////////////
template <typename ...Ts>
HPX_FORCEINLINE result_type operator()(
launch policy, naming::id_type const& id,
error_code& ec, Ts&&... vs) const
{
return sync_invoke::call(policy, id, ec, std::forward<Ts>(vs)...);
}
template <typename ...Ts>
HPX_FORCEINLINE result_type operator()(
naming::id_type const& id, error_code& ec, Ts&&... vs) const
{
return sync_invoke::call(
launch::sync, id, ec, std::forward<Ts>(vs)...);
}
template <typename ...Ts>
HPX_FORCEINLINE result_type operator()(
launch policy, naming::id_type const& id,
Ts&&... vs) const
{
return sync_invoke::call(
policy, id, throws, std::forward<Ts>(vs)...);
}
template <typename ...Ts>
HPX_FORCEINLINE result_type operator()(
naming::id_type const& id, Ts&&... vs) const
{
return sync_invoke::call(
launch::sync, id, throws, std::forward<Ts>(vs)...);
}
///////////////////////////////////////////////////////////////////////
template <typename DistPolicy, typename ...Ts>
HPX_FORCEINLINE
typename std::enable_if<
traits::is_distribution_policy<DistPolicy>::value,
result_type
>::type
operator()(launch policy,
DistPolicy const& dist_policy, error_code& ec, Ts&&... vs) const
{
return sync_invoke::call(
policy, dist_policy, ec, std::forward<Ts>(vs)...);
}
template <typename DistPolicy, typename ...Ts>
HPX_FORCEINLINE
typename std::enable_if<
traits::is_distribution_policy<DistPolicy>::value,
result_type
>::type
operator()(DistPolicy const& dist_policy, error_code& ec,
Ts&&... vs) const
{
return sync_invoke::call(
launch::sync, dist_policy, ec, std::forward<Ts>(vs)...);
}
template <typename DistPolicy, typename ...Ts>
HPX_FORCEINLINE
typename std::enable_if<
traits::is_distribution_policy<DistPolicy>::value,
result_type
>::type
operator()(launch policy,
DistPolicy const& dist_policy, Ts&&... vs) const
{
return sync_invoke::call(
policy, dist_policy, throws, std::forward<Ts>(vs)...);
}
template <typename DistPolicy, typename ...Ts>
HPX_FORCEINLINE
typename std::enable_if<
traits::is_distribution_policy<DistPolicy>::value,
result_type
>::type
operator()(DistPolicy const& dist_policy, Ts&&... vs) const
{
return sync_invoke::call(
launch::sync, dist_policy, throws, std::forward<Ts>(vs)...);
}
///////////////////////////////////////////////////////////////////////
/// retrieve component type
static int get_component_type()
{
return static_cast<int>(components::get_component_type<Component>());
}
/// The function \a get_action_type returns whether this action needs
/// to be executed in a new thread or directly.
static base_action::action_type get_action_type()
{
return base_action::plain_action;
}
/// Extract the current invocation count for this action
static std::int64_t get_invocation_count(bool reset)
{
return util::get_and_reset_value(invocation_count_, reset);
}
private:
static std::atomic<std::int64_t> invocation_count_;
protected:
static void increment_invocation_count()
{
++invocation_count_;
}
};
template <typename Component, typename R, typename ...Args, typename Derived>
std::atomic<std::int64_t>
basic_action<Component, R(Args...), Derived>::invocation_count_(0);
namespace detail
{
template <typename Action>
void register_local_action_invocation_count(
invocation_count_registry& registry)
{
registry.register_class(
hpx::actions::detail::get_action_name<Action>(),
&Action::get_invocation_count
);
}
}
///////////////////////////////////////////////////////////////////////////
namespace detail
{
// simple type allowing to distinguish whether an action is the most
// derived one
struct this_type {};
template <typename Action, typename Derived>
struct action_type
{
typedef Derived type;
};
template <typename Action>
struct action_type<Action, this_type>
{
typedef Action type;
};
}
///////////////////////////////////////////////////////////////////////////
template <typename Signature, typename TF, TF F, typename Derived>
class basic_action_impl;
///////////////////////////////////////////////////////////////////////////
template <typename TF, TF F, typename Derived = detail::this_type>
struct action
: basic_action_impl<TF, TF, F,
typename detail::action_type<
action<TF, F, Derived>,
Derived
>::type>
{
typedef typename detail::action_type<
action, Derived
>::type derived_type;
typedef std::false_type direct_execution;
};
///////////////////////////////////////////////////////////////////////////
template <typename TF, TF F, typename Derived = detail::this_type>
struct direct_action
: basic_action_impl<TF, TF, F,
typename detail::action_type<
direct_action<TF, F, Derived>,
Derived
>::type>
{
typedef typename detail::action_type<
direct_action, Derived
>::type derived_type;
typedef std::true_type direct_execution;
/// The function \a get_action_type returns whether this action needs
/// to be executed in a new thread or directly.
static base_action::action_type get_action_type()
{
return base_action::direct_action;
}
};
///////////////////////////////////////////////////////////////////////////
// Base template allowing to generate a concrete action type from a function
// pointer. It is instantiated only if the supplied pointer is not a
// supported function pointer.
template <typename TF, TF F, typename Derived = detail::this_type,
typename Direct = std::false_type>
struct make_action;
template <typename TF, TF F, typename Derived>
struct make_action<TF, F, Derived, std::false_type>
: action<TF, F, Derived>
{
typedef action<TF, F, Derived> type;
};
template <typename TF, TF F, typename Derived>
struct make_action<TF, F, Derived, std::true_type>
: direct_action<TF, F, Derived>
{
typedef direct_action<TF, F, Derived> type;
};
template <typename TF, TF F, typename Derived = detail::this_type>
struct make_direct_action
: make_action<TF, F, Derived, std::true_type>
{};
// Macros usable to refer to an action given the function to expose
#define HPX_MAKE_ACTION(func) \
hpx::actions::make_action<decltype(&func), &func> /**/ \
/**/
#define HPX_MAKE_DIRECT_ACTION(func) \
hpx::actions::make_direct_action<decltype(&func), &func> /**/ \
/**/
enum preassigned_action_id
{
register_worker_action_id = 0,
notify_worker_action_id,
allocate_action_id,
base_connect_action_id,
base_disconnect_action_id,
base_set_event_action_id,
base_set_exception_action_id,
broadcast_call_shutdown_functions_action_id,
broadcast_call_startup_functions_action_id,
broadcast_symbol_namespace_on_event_action_id,
call_shutdown_functions_action_id,
call_startup_functions_action_id,
component_namespace_bind_prefix_action_id,
component_namespace_bind_name_action_id,
component_namespace_resolve_id_action_id,
component_namespace_unbind_action_id,
component_namespace_iterate_types_action_id,
component_namespace_get_component_type_action_id,
component_namespace_get_num_localities_action_id,
component_namespace_statistics_counter_action_id,
console_error_sink_action_id,
console_logging_action_id,
console_print_action_id,
create_memory_block_action_id,
create_performance_counter_action_id,
dijkstra_termination_action_id,
free_component_action_id,
garbage_collect_action_id,
get_config_action_id,
hpx_get_locality_name_action_id,
hpx_lcos_server_barrier_create_component_action_id,
hpx_lcos_server_latch_create_component_action_id,
hpx_lcos_server_latch_wait_action_id,
list_component_type_action_id,
list_symbolic_name_action_id,
load128_action_id,
load16_action_id,
load32_action_id,
load64_action_id,
load8_action_id,
load_components_action_id,
locality_namespace_allocate_action_id,
locality_namespace_free_action_id,
locality_namespace_localities_action_id,
locality_namespace_resolve_locality_action_id,
locality_namespace_get_num_localities_action_id,
locality_namespace_get_num_threads_action_id,
locality_namespace_get_num_overall_threads_action_id,
locality_namespace_statistics_counter_action_id,
memory_block_checkin_action_id,
memory_block_checkout_action_id,
memory_block_clone_action_id,
memory_block_get_action_id,
memory_block_get_config_action_id,
output_stream_write_async_action_id,
output_stream_write_sync_action_id,
performance_counter_get_counter_info_action_id,
performance_counter_get_counter_value_action_id,
performance_counter_get_counter_values_array_action_id,
performance_counter_set_counter_value_action_id,
performance_counter_reset_counter_value_action_id,
performance_counter_start_action_id,
performance_counter_stop_action_id,
primary_namespace_allocate_action_id,
primary_namespace_begin_migration_action_id,
primary_namespace_bind_gid_action_id,
primary_namespace_colocate_action_id,
primary_namespace_decrement_credit_action_id,
primary_namespace_end_migration_action_id,
primary_namespace_increment_credit_action_id,
primary_namespace_resolve_gid_action_id,
primary_namespace_route_action_id,
primary_namespace_unbind_gid_action_id,
primary_namespace_statistics_counter_action_id,
remove_from_connection_cache_action_id,
set_value_action_agas_bool_response_type_id,
set_value_action_agas_id_type_response_type_id,
shutdown_action_id,
shutdown_all_action_id,
store128_action_id,
store16_action_id,
store32_action_id,
store64_action_id,
store8_action_id,
symbol_namespace_bind_action_id,
symbol_namespace_resolve_action_id,
symbol_namespace_unbind_action_id,
symbol_namespace_iterate_action_id,
symbol_namespace_on_event_action_id,
symbol_namespace_statistics_counter_action_id,
terminate_action_id,
terminate_all_action_id,
update_agas_cache_action_id,
register_worker_security_action_id,
notify_worker_security_action_id,
base_lco_with_value_gid_get,
base_lco_with_value_gid_set,
base_lco_with_value_vector_gid_get,
base_lco_with_value_vector_gid_set,
base_lco_with_value_id_get,
base_lco_with_value_id_set,
base_lco_with_value_vector_id_get,
base_lco_with_value_vector_id_set,
base_lco_with_value_unused_get,
base_lco_with_value_unused_set,
base_lco_with_value_float_get,
base_lco_with_value_float_set,
base_lco_with_value_double_get,
base_lco_with_value_double_set,
base_lco_with_value_int8_get,
base_lco_with_value_int8_set,
base_lco_with_value_uint8_get,
base_lco_with_value_uint8_set,
base_lco_with_value_int16_get,
base_lco_with_value_int16_set,
base_lco_with_value_uint16_get,
base_lco_with_value_uint16_set,
base_lco_with_value_int32_get,
base_lco_with_value_int32_set,
base_lco_with_value_uint32_get,
base_lco_with_value_uint32_set,
base_lco_with_value_int64_get,
base_lco_with_value_int64_set,
base_lco_with_value_uint64_get,
base_lco_with_value_uint64_set,
base_lco_with_value_uint128_get,
base_lco_with_value_uint128_set,
base_lco_with_value_bool_get,
base_lco_with_value_bool_set,
base_lco_with_value_hpx_section_get,
base_lco_with_value_hpx_section_set,
base_lco_with_value_hpx_counter_info_get,
base_lco_with_value_hpx_counter_info_set,
base_lco_with_value_hpx_counter_value_get,
base_lco_with_value_hpx_counter_value_set,
base_lco_with_value_hpx_counter_values_array_get,
base_lco_with_value_hpx_counter_values_array_set,
base_lco_with_value_hpx_memory_data_get,
base_lco_with_value_hpx_memory_data_set,
base_lco_with_value_std_string_get,
base_lco_with_value_std_string_set,
base_lco_with_value_std_bool_ptrdiff_get,
base_lco_with_value_std_bool_ptrdiff_set,
base_lco_with_value_vector_bool_get,
base_lco_with_value_vector_bool_set,
base_lco_with_value_naming_address_get,
base_lco_with_value_naming_address_set,
base_lco_with_value_gva_tuple_get,
base_lco_with_value_gva_tuple_set,
base_lco_with_value_std_pair_address_id_type_get,
base_lco_with_value_std_pair_address_id_type_set,
base_lco_with_value_std_pair_gid_type_get,
base_lco_with_value_std_pair_gid_type_set,
base_lco_with_value_id_type_get,
base_lco_with_value_id_type_set,
base_lco_with_value_vector_std_int64_get,
base_lco_with_value_vector_std_int64_set,
base_lco_with_value_vector_id_gid_get,
base_lco_with_value_vector_id_gid_set,
base_lco_with_value_vector_std_uint32_get,
base_lco_with_value_vector_std_uint32_set,
base_lco_with_value_parcelset_endpoints_get,
base_lco_with_value_parcelset_endpoints_set,
base_lco_with_value_vector_compute_host_target_get,
base_lco_with_value_vector_compute_host_target_set,
base_lco_with_value_vector_compute_cuda_target_get,
base_lco_with_value_vector_compute_cuda_target_set,
// typed continuations...
typed_continuation_hpx_agas_response,
last_action_id
};
/// \endcond
}}
/// \cond NOINTERNAL
namespace hpx { namespace serialization
{
template <
typename Archive,
typename Component, typename R, typename ...Args, typename Derived
>
HPX_FORCEINLINE
void serialize(
Archive& ar
, ::hpx::actions::basic_action<Component, R(Args...), Derived>& t
, unsigned int const version = 0
)
{}
}}
///////////////////////////////////////////////////////////////////////////////
/// \def HPX_DECLARE_ACTION(func, name)
/// \brief Declares an action type
///
#define HPX_DECLARE_ACTION(...) \
HPX_DECLARE_ACTION_(__VA_ARGS__) \
/**/
/// \cond NOINTERNAL
#define HPX_DECLARE_DIRECT_ACTION(...) \
HPX_DECLARE_ACTION(__VA_ARGS__) \
/**/
#define HPX_DECLARE_ACTION_(...) \
HPX_PP_EXPAND(HPX_PP_CAT( \
HPX_DECLARE_ACTION_, HPX_PP_NARGS(__VA_ARGS__) \
)(__VA_ARGS__)) \
/**/
#define HPX_DECLARE_ACTION_1(func) \
HPX_DECLARE_ACTION_2(func, HPX_PP_CAT(func, _action)) \
/**/
#define HPX_DECLARE_ACTION_2(func, name) struct name; \
/**/
///////////////////////////////////////////////////////////////////////////////
// Helper macro for action serialization, each of the defined actions needs to
// be registered with the serialization library
#define HPX_DEFINE_GET_ACTION_NAME(action) \
HPX_DEFINE_GET_ACTION_NAME_(action, action) \
/**/
#if HPX_HAVE_ITTNOTIFY != 0 && !defined(HPX_HAVE_APEX)
#define HPX_DEFINE_GET_ACTION_NAME_ITT(action, actionname) \
namespace hpx { namespace actions { namespace detail { \
template<> HPX_ALWAYS_EXPORT \
util::itt::string_handle const& get_action_name_itt< action>() \
{ \
static util::itt::string_handle sh(HPX_PP_STRINGIZE(actionname)); \
return sh; \
} \
}}} \
/**/
#else
#define HPX_DEFINE_GET_ACTION_NAME_ITT(action, actionname)
#endif
#define HPX_DEFINE_GET_ACTION_NAME_(action, actionname) \
HPX_DEFINE_GET_ACTION_NAME_ITT(action, actionname) \
namespace hpx { namespace actions { namespace detail { \
template<> HPX_ALWAYS_EXPORT \
char const* get_action_name< action>() \
{ \
return HPX_PP_STRINGIZE(actionname); \
} \
}}} \
/**/
#define HPX_REGISTER_ACTION_(...) \
HPX_PP_EXPAND(HPX_PP_CAT( \
HPX_REGISTER_ACTION_, HPX_PP_NARGS(__VA_ARGS__) \
)(__VA_ARGS__)) \
/**/
#define HPX_REGISTER_ACTION_1(action) \
HPX_REGISTER_ACTION_2(action, action) \
/**/
#define HPX_REGISTER_ACTION_2(action, actionname) \
HPX_DEFINE_GET_ACTION_NAME_(action, actionname) \
HPX_REGISTER_ACTION_INVOCATION_COUNT(action) \
HPX_REGISTER_PER_ACTION_DATA_COUNTER_TYPES(action) \
namespace hpx { namespace actions { \
template struct HPX_ALWAYS_EXPORT transfer_action< action>; \
template struct HPX_ALWAYS_EXPORT \
transfer_continuation_action< action>; \
}} \
/**/
#if defined(HPX_MSVC) || defined(HPX_MINGW)
#define HPX_REGISTER_ACTION_EXTERN_DECLARATION(action) \
/**/
#else
#define HPX_REGISTER_ACTION_EXTERN_DECLARATION(action) \
namespace hpx { namespace actions { \
extern template struct HPX_ALWAYS_IMPORT transfer_action< action>; \
extern template struct HPX_ALWAYS_IMPORT \
transfer_continuation_action< action>; \
}} \
/**/
#endif
///////////////////////////////////////////////////////////////////////////////
#if HPX_HAVE_ITTNOTIFY != 0 && !defined(HPX_HAVE_APEX)
#define HPX_REGISTER_ACTION_DECLARATION_NO_DEFAULT_GUID_ITT(action) \
namespace hpx { namespace actions { namespace detail { \
template <> HPX_ALWAYS_EXPORT \
util::itt::string_handle const& get_action_name_itt< action>(); \
}}} \
/**/
#else
#define HPX_REGISTER_ACTION_DECLARATION_NO_DEFAULT_GUID_ITT(action)
#endif
#define HPX_REGISTER_ACTION_DECLARATION_NO_DEFAULT_GUID(action) \
HPX_REGISTER_ACTION_DECLARATION_NO_DEFAULT_GUID_ITT(action) \
namespace hpx { namespace actions { namespace detail { \
template <> HPX_ALWAYS_EXPORT \
char const* get_action_name< action>(); \
}}} \
HPX_REGISTER_ACTION_EXTERN_DECLARATION(action) \
\
namespace hpx { namespace traits { \
template <> \
struct is_action< action> \
: std::true_type \
{}; \
template <> \
struct needs_automatic_registration< action> \
: std::false_type \
{}; \
}} \
/**/
#define HPX_REGISTER_ACTION_DECLARATION_(...) \
HPX_PP_EXPAND(HPX_PP_CAT( \
HPX_REGISTER_ACTION_DECLARATION_, HPX_PP_NARGS(__VA_ARGS__) \
)(__VA_ARGS__)) \
/**/
#define HPX_REGISTER_ACTION_DECLARATION_1(action) \
HPX_REGISTER_ACTION_DECLARATION_2(action, action) \
/**/
#define HPX_REGISTER_ACTION_DECLARATION_2(action, actionname) \
HPX_REGISTER_ACTION_DECLARATION_NO_DEFAULT_GUID(action) \
/**/
///////////////////////////////////////////////////////////////////////////////
#define HPX_ACTION_USES_STACK(action, size) \
namespace hpx { namespace traits \
{ \
template <> \
struct action_stacksize< action> \
{ \
enum { value = size }; \
}; \
}} \
/**/
#define HPX_ACTION_USES_SMALL_STACK(action) \
HPX_ACTION_USES_STACK(action, threads::thread_stacksize_small) \
/**/
#define HPX_ACTION_USES_MEDIUM_STACK(action) \
HPX_ACTION_USES_STACK(action, threads::thread_stacksize_medium) \
/**/
#define HPX_ACTION_USES_LARGE_STACK(action) \
HPX_ACTION_USES_STACK(action, threads::thread_stacksize_large) \
/**/
#define HPX_ACTION_USES_HUGE_STACK(action) \
HPX_ACTION_USES_STACK(action, threads::thread_stacksize_huge) \
/**/
// This macro is deprecated. It expands to an inline function which will emit a
// warning.
#define HPX_ACTION_DOES_NOT_SUSPEND(action) \
HPX_DEPRECATED("HPX_ACTION_DOES_NOT_SUSPEND is deprecated and will be " \
"removed in the next release") \
static inline void HPX_PP_CAT(HPX_ACTION_DOES_NOT_SUSPEND_, action)(); \
void HPX_PP_CAT(HPX_ACTION_DOES_NOT_SUSPEND_, action)() \
{ \
HPX_PP_CAT(HPX_ACTION_DOES_NOT_SUSPEND_, action)(); \
} \
/**/
///////////////////////////////////////////////////////////////////////////////
#define HPX_ACTION_HAS_PRIORITY(action, priority) \
namespace hpx { namespace traits \
{ \
template <> \
struct action_priority< action> \
{ \
enum { value = priority }; \
}; \
/* make sure the action is not executed directly */ \
template <> \
struct has_decorates_action< action> \
: std::true_type \
{}; \
}} \
/**/
#define HPX_ACTION_HAS_LOW_PRIORITY(action) \
HPX_ACTION_HAS_PRIORITY(action, threads::thread_priority_low) \
/**/
#define HPX_ACTION_HAS_NORMAL_PRIORITY(action) \
HPX_ACTION_HAS_PRIORITY(action, threads::thread_priority_normal) \
/**/
#define HPX_ACTION_HAS_HIGH_PRIORITY(action) \
HPX_ACTION_HAS_PRIORITY(action, threads::thread_priority_high) \
/**/
#define HPX_ACTION_HAS_HIGH_RECURSIVE_PRIORITY(action) \
HPX_ACTION_HAS_PRIORITY(action, threads::thread_priority_high_recursive) \
/**/
// obsolete, kept for compatibility
#define HPX_ACTION_HAS_CRITICAL_PRIORITY(action) \
HPX_ACTION_HAS_PRIORITY(action, threads::thread_priority_high_recursive) \
/**/