FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
taskflow/examples/attach_data.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
/
attach_data.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
26 lines (19 loc) · 590 Bytes
Breadcrumbs
taskflow
/
examples
/
attach_data.cpp
Copy path
File metadata and controls
26 lines (19 loc) · 590 Bytes
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
//
This example demonstrates how to attach data to a task and run
//
the task iteratively with changing data.
#
include
<
taskflow/taskflow.hpp
>
int
main
(){
tf::Executor executor;
tf::Taskflow
taskflow
(
"
attach data to a task
"
);
int
data;
//
create a task and attach it the data
auto
A = taskflow.
placeholder
();
A.
data
(&data).
work
([A](){
auto
d = *
static_cast
<
int
*>(A.
data
());
std::cout <<
"
data is
"
<< d << std::endl;
});
//
run the taskflow iteratively with changing data
for
(data =
0
; data<
10
; data++){
executor.
run
(taskflow).
wait
();
}
return
0
;
}
Back
|
FazBrowse Home
|
New Git URL