xtd 0.2.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(const xtd::array<xtd::action<>>& actions) -> void {
36 for (const auto& action : actions)
39 }
40
41 template<class collection_t>
42 static auto invoke(const collection_t& actions) -> void {
44 for (const auto& action : actions)
47 }
48
49 template<typename ...args_t>
50 static auto invoke(args_t... args) -> void {invoke(xtd::array<xtd::action<>> {xtd::action<> {std::forward<args_t>(args)}...});}
51
53 static auto invoke(const xtd::array<std::function<void()>>& actions) -> void {
54 xtd::collections::generic::list<xtd::threading::tasks::task<>> tasks;
55 for (const auto& action : actions)
56 tasks.add(xtd::threading::tasks::task<>::factory().start_new(action));
57 task<>::wait_all(tasks);
58 }
60 };
61 }
62 }
63}
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
auto add(const type_t &item) -> void override
Adds an object to the end of the xtd::collections::generic::list <type_t>.
Definition list.hpp:273
Provides support for creating and scheduling Task objects.
Definition parallel.hpp:22
static auto invoke(const xtd::array< xtd::action<> > &actions) -> void
Executes each of the provided actions, possibly in parallel.
Definition parallel.hpp:34
Represents an asynchronous operation.
Definition task_result.hpp:20
#define static_
This keyword is use to represent a static object. A static object can't be instantiated (constructors...
Definition static.hpp:37
delegate< void(arguments_t...)> action
Represents a xtd::delegate that has variable parameters and does not return a value.
Definition action.hpp:20
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 itask.hpp:14
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.