-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain_Test.cpp
More file actions
49 lines (42 loc) · 913 Bytes
/
Copy pathmain_Test.cpp
File metadata and controls
49 lines (42 loc) · 913 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
37
38
39
40
41
42
43
44
45
46
47
48
49
#include <future>
#include <functional>
#include "include/threadPool.hpp"
int TestFunction(int a, int b)
{
printf("[TestFunction]: done!\n");
return a;
}
void Test() {
threadPool testPool(6);
// result[0] = 0;
for (int i = 0; i < 100; i++)
testPool.submitTask(TestFunction, 1, 2);
}
int main(void)
{
Test();
//std::this_thread::sleep_for(std::chrono::seconds(1));
std::cout << "[Main thread]: Main func is done!" << '\n';
return 0;
}
// #include <mingw.thread.h>
// #include <iostream>
// #include <vector>
// int func (int a)
// {
// std::cout << a << std::endl;
// return a;
// }
// int main(void)
// {
// int x = 1;
// std::vector<std::thread> array(10);
// for (auto &thread_ : array)
// {
// thread_ = std::thread(func, x ++);
// }
// for (auto &thread_ : array)
// {
// thread_.join();
// }
// }