xtd 1.0.0
Loading...
Searching...
No Matches
parallel.hpp
Go to the documentation of this file.
1
4#pragma once
5#include "task_factory.hpp"
7#include "../../array.hpp"
8#include "../../static.hpp"
9
11namespace xtd {
13 namespace threading {
15 namespace tasks {
23 public:
34 static auto invoke(xtd::array<xtd::action<>>&& actions) -> void {
35 task<>::wait_all(invoke_async(actions));
36 }
37
47 template<typename collection_t>
48 static auto invoke(collection_t&& actions) -> void {
49 task<>::wait_all(invoke_async(actions));
50 }
51
61 template<typename ...args_t>
62 static auto invoke(args_t&&... args) -> void {invoke(xtd::array<xtd::action<>> {xtd::action<> {std::forward<args_t>(args)}...});}
63
64 static auto invoke_async(xtd::array<xtd::action<>>&& actions) -> xtd::array<xtd::threading::tasks::task<>> {
66 for (const auto& action : actions)
67 tasks.add(xtd::threading::tasks::task<>::factory().start_new(action));
68 return tasks.to_array();
69 }
70
71 template<typename collection_t>
72 static auto invoke_async(collection_t&& actions) -> xtd::array<xtd::threading::tasks::task<>> {
74 for (const auto& action : actions)
75 tasks.add(xtd::threading::tasks::task<>::factory().start_new(action));
76 return tasks.to_array();
77 }
78
79 template<typename ...args_t>
80 static auto invoke_async(args_t&&... args) -> xtd::array<xtd::threading::tasks::task<>> {return invoke_async(xtd::array<xtd::action<>> {xtd::action<> {std::forward<args_t>(args)}...});}
81 };
82 }
83 }
84}
Contains xtd::array class.
Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the ba...
Definition array.hpp:64
Represents a strongly typed list of objects that can be accessed by index. Provides methods to search...
Definition list.hpp:80
Provides support for creating and scheduling Task objects.
Definition parallel.hpp:22
static auto invoke(collection_t &&actions) -> void
Executes each of the provided actions, possibly in parallel.
Definition parallel.hpp:48
static auto invoke(args_t &&... args) -> void
Executes each of the provided actions, possibly in parallel.
Definition parallel.hpp:62
static auto invoke(xtd::array< xtd::action<> > &&actions) -> void
Executes each of the provided actions, possibly in parallel.
Definition parallel.hpp:34
#define static_
This keyword is use to represent a static object. A static object can't be instantiated (constructors...
Definition static.hpp:38
Contains xtd::collections::generic::list <type_t> class.
The xtd::threading::tasks namespace provides types that simplify the work of writing concurrent and a...
Definition basic_task.hpp:32
The xtd::threading namespace provides classes and interfaces that enable multithreaded programming....
Definition abandoned_mutex_exception.hpp:10
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
Contains xtd::static_object class.
Contains xtd::threading::tasks::task_factory <result_t> class.