From 9394724b5326fa455cf81384108a814cb0acf941 Mon Sep 17 00:00:00 2001 From: ericek111 Date: Sun, 29 May 2022 22:59:56 +0200 Subject: [PATCH] add CLI params --- main.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/main.cpp b/main.cpp index 8ab01a3..42d90d9 100644 --- a/main.cpp +++ b/main.cpp @@ -1,9 +1,14 @@ #include #include +#include -int main() +int main(int argc, char* argv[]) { - MyThreadPool::ThreadPool tp(4); + size_t threadCount = 0; + if (argc > 1) { + threadCount = std::stoull(argv[1]); + } + MyThreadPool::ThreadPool tp(threadCount); auto task = [](int i) { std::this_thread::sleep_for(std::chrono::milliseconds(500));