add CLI params
This commit is contained in:
parent
2c0dc2aa70
commit
d183bc7142
9
main.cpp
9
main.cpp
@ -1,9 +1,14 @@
|
|||||||
#include <MyThreadPool.h>
|
#include <MyThreadPool.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
int main()
|
int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
MyThreadPool::ThreadPool tp(4);
|
size_t threadCount = 0;
|
||||||
|
if (argc > 1) {
|
||||||
|
threadCount = std::stoul(argv[1]);
|
||||||
|
}
|
||||||
|
MyThreadPool::ThreadPool tp(threadCount);
|
||||||
|
|
||||||
auto task = [](int i) {
|
auto task = [](int i) {
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(500));
|
std::this_thread::sleep_for(std::chrono::milliseconds(500));
|
||||||
|
Loading…
Reference in New Issue
Block a user