We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 37979bb commit 66890f6Copy full SHA for 66890f6
cpr/threadpool.cpp
@@ -1,4 +1,5 @@
1
#include "cpr/threadpool.h"
2
+#include <algorithm>
3
#include <chrono>
4
#include <cstddef>
5
#include <ctime>
@@ -20,12 +21,7 @@ int ThreadPool::Start(size_t start_threads) {
20
21
return -1;
22
}
23
status = RUNNING;
- if (start_threads < min_thread_num) {
24
- start_threads = min_thread_num;
25
- }
26
- if (start_threads > max_thread_num) {
27
- start_threads = max_thread_num;
28
+ start_threads = std::clamp(start_threads, min_thread_num, max_thread_num);
29
for (size_t i = 0; i < start_threads; ++i) {
30
CreateThread();
31
0 commit comments