-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdoppl.hpp
More file actions
36 lines (30 loc) · 736 Bytes
/
doppl.hpp
File metadata and controls
36 lines (30 loc) · 736 Bytes
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
#ifndef _DOPPL
#define _DOPPL
#include "doppl_libs.hpp"
#include "doppl_task_loop.hpp"
#include "doppl_data_member.hpp"
#include "doppl_future_member.hpp"
#include "doppl_state_member.hpp"
#include "doppl_stdio.hpp"
#include "doppl_shared_member.hpp"
template<int range, typename F>
inline int doppl_run(F task_body) {
//Task group
std::array< std::future<int> , range> task_list;
//Task init
for(int i = 0; i < range; i++) {
task_list[i] = std::async(
std::launch::async,
task_body,
//Task id
i
);
}
//Task return wait
int return_val = 0;
for(auto& t : task_list) {
return_val |= t.get();
}
return return_val;
};
#endif