-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
33 lines (26 loc) · 681 Bytes
/
main.cpp
File metadata and controls
33 lines (26 loc) · 681 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
#include <functional>
#include <taskflow/taskflow.hpp>
#include <thread>
#include <vector>
#include "dbg_out.h"
void print1(size_t job_id) {
dbg_out("Executing", "job", job_id, "from", "print1()");
}
void print2(size_t job_id) {
dbg_out("Executing", "job", job_id, "from", "print2()");
}
void print3(size_t job_id) {
dbg_out("Executing", "job", job_id, "from", "print3()");
}
int main() {
static constexpr size_t num_jobs = 100'000;
tf::Executor ex;
tf::Taskflow tf;
for (size_t i = 0; i < num_jobs; ++i) {
tf.emplace([i]() { print1(i); });
tf.emplace([i]() { print2(i); });
tf.emplace([i]() { print3(i); });
}
ex.run(tf).wait();
return 0;
}