xtd
1.0.0
Toggle main menu visibility
Loading...
Searching...
No Matches
xtd.core
include
xtd
threading
tasks
parallel.hpp
Go to the documentation of this file.
1
4
#pragma once
5
#include "
task_factory.hpp
"
6
#include "
../../collections/generic/list.hpp
"
7
#include "
../../array.hpp
"
8
#include "
../../static.hpp
"
9
11
namespace
xtd
{
13
namespace
threading
{
15
namespace
tasks
{
22
class
parallel
static_
{
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<>
> {
65
xtd::collections::generic::list<xtd::threading::tasks::task<>
>
tasks
;
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<>
> {
73
xtd::collections::generic::list<xtd::threading::tasks::task<>
>
tasks
;
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
}
array.hpp
Contains xtd::array class.
xtd::array
Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the ba...
Definition
array.hpp:64
xtd::collections::generic::list
Represents a strongly typed list of objects that can be accessed by index. Provides methods to search...
Definition
list.hpp:80
xtd::threading::tasks::parallel
Provides support for creating and scheduling Task objects.
Definition
parallel.hpp:22
xtd::threading::tasks::parallel::invoke
static auto invoke(collection_t &&actions) -> void
Executes each of the provided actions, possibly in parallel.
Definition
parallel.hpp:48
xtd::threading::tasks::parallel::invoke
static auto invoke(args_t &&... args) -> void
Executes each of the provided actions, possibly in parallel.
Definition
parallel.hpp:62
xtd::threading::tasks::parallel::invoke
static auto invoke(xtd::array< xtd::action<> > &&actions) -> void
Executes each of the provided actions, possibly in parallel.
Definition
parallel.hpp:34
static_
#define static_
This keyword is use to represent a static object. A static object can't be instantiated (constructors...
Definition
static.hpp:38
list.hpp
Contains xtd::collections::generic::list <type_t> class.
xtd::threading::tasks
The xtd::threading::tasks namespace provides types that simplify the work of writing concurrent and a...
Definition
basic_task.hpp:32
xtd::threading
The xtd::threading namespace provides classes and interfaces that enable multithreaded programming....
Definition
abandoned_mutex_exception.hpp:10
xtd
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition
abstract_object.hpp:8
static.hpp
Contains xtd::static_object class.
task_factory.hpp
Contains xtd::threading::tasks::task_factory <result_t> class.
Generated on
for xtd by
Gammasoft
. All rights reserved.