FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
taskflow/examples/async_module.cpp at task_isolation · ModuleWorks/taskflow · GitHub
ModuleWorks
/
taskflow
Public
forked from
taskflow/taskflow
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
taskflow
/
examples
/
async_module.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
37 lines (29 loc) · 1.16 KB
Breadcrumbs
taskflow
/
examples
/
async_module.cpp
Copy path
File metadata and controls
37 lines (29 loc) · 1.16 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
37
//
This program demonstrates how to launch taskflows using asynchronous tasking.
#
include
<
taskflow/taskflow.hpp
>
#
include
<
taskflow/algorithm/module.hpp
>
int
main
() {
tf::Executor executor;
tf::Taskflow A;
tf::Taskflow B;
tf::Taskflow C;
tf::Taskflow D;
A.
emplace
([](){
printf
(
"
Taskflow A
\n
"
); });
B.
emplace
([](){
printf
(
"
Taskflow B
\n
"
); });
C.
emplace
([](){
printf
(
"
Taskflow C
\n
"
); });
D.
emplace
([](){
printf
(
"
Taskflow D
\n
"
); });
//
launch the four taskflows using async
printf
(
"
launching four taskflows using async ...
\n
"
);
executor.
async
(
tf::make_module_task
(A));
executor.
async
(
tf::make_module_task
(B));
executor.
async
(
tf::make_module_task
(C));
executor.
async
(
tf::make_module_task
(D));
executor.
wait_for_all
();
//
launch four taskflows with dependencies
printf
(
"
launching four taskflows using dependent async ...
\n
"
);
auto
TA
= executor.
silent_dependent_async
(
tf::make_module_task
(A));
auto
TB
= executor.
silent_dependent_async
(
tf::make_module_task
(B),
TA
);
auto
TC
= executor.
silent_dependent_async
(
tf::make_module_task
(C),
TB
);
auto
[
TD
,
FD
] = executor.
dependent_async
(
tf::make_module_task
(D),
TC
);
FD
.
get
();
return
0
;
}
Back
|
FazBrowse Home
|
New Git URL