hpx::experimental::task_group#
Defined in header hpx/experimental/task_group.hpp.
See Public API for a list of names and headers that are part of the public HPX API.
-
namespace hpx
-
namespace execution#
-
namespace experimental#
Typedefs
-
using instead = hpx::experimental::task_group#
-
using instead = hpx::experimental::task_group#
-
namespace experimental#
-
namespace experimental
Top-level namespace.
-
class task_group#
- #include <task_group.hpp>
A
task_group
represents concurrent execution of a group of tasks. Tasks can be dynamically added to the group while it is executing.Public Functions
-
task_group()#
-
~task_group()#
-
task_group(task_group const&) = delete#
-
task_group(task_group&&) = delete#
-
task_group &operator=(task_group const&) = delete#
-
task_group &operator=(task_group&&) = delete#
- template<typename Executor, typename F, typename... Ts> requires (hpx::traits::is_executor_any_v< std::decay_t< Executor >>) void run(Executor &&exec
Adds a task to compute
f()
and returns immediately.- Template Parameters
Executor – The type of the executor to associate with this execution policy.
F – The type of the user defined function to invoke.
Ts – The type of additional arguments used to invoke
f()
.
- Parameters
exec – The executor to use for the execution of the parallel algorithm the returned execution policy is used with.
f – The user defined function to invoke inside the task group.
ts – Additional arguments to use to invoke
f()
.
- hpx::parallel::execution::post (HPX_FORWARD(Executor, exec), [this, on_exit=HPX_MOVE(on_exit), f=HPX_FORWARD(F, f), t=hpx::make_tuple(HPX_FORWARD(Ts, ts)...)]() mutable { auto _(HPX_MOVE(on_exit));hpx::detail::try_catch_exception_ptr([&]() { hpx::invoke_fused(HPX_MOVE(f), HPX_MOVE(t));}, [this](std::exception_ptr e) { add_exception(HPX_MOVE(e));});})
- template<typename F, typename... Ts> requires (!hpx::traits::is_executor_any_v< std::decay_t< F >>) void run(F &&f
Adds a task to compute
f()
and returns immediately.- Template Parameters
F – The type of the user defined function to invoke.
Ts – The type of additional arguments used to invoke
f()
.
- Parameters
f – The user defined function to invoke inside the task group.
ts – Additional arguments to use to invoke
f()
.
-
void wait()#
Waits for all tasks in the group to complete or be cancelled.
-
void add_exception(std::exception_ptr p)#
Adds an exception to this
task_group
.
Public Members
-
F &&f#
- F Ts && ts {if (latch_.reset_if_needed_and_count_up(1, 1)){has_arrived_.store(false, std::memory_order_release);}auto on_exit =hpx::experimental::scope_exit([this] { latch_.count_down(1); })
- Ts && ts {run(execution::parallel_executor{}, HPX_FORWARD(F, f),HPX_FORWARD(Ts, ts)...)
Private Types
Private Functions
-
void serialize(serialization::output_archive&, unsigned const)#
Private Static Functions
-
static inline constexpr void serialize(serialization::input_archive&, unsigned const) noexcept#
Friends
- friend class serialization::access
-
task_group()#
-
class task_group#
-
namespace execution#