From 281eea2ef4581fc126797c33131946ec2b6e72c5 Mon Sep 17 00:00:00 2001 From: Yoel <s73017@beuth-hochschule.de> Date: Wed, 2 Sep 2020 13:25:00 +0200 Subject: [PATCH] Fixed threading function args, i is not needed --- RayTracer/tools/Threadpool.cpp | 4 ++-- RayTracer/tools/Threadpool.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/RayTracer/tools/Threadpool.cpp b/RayTracer/tools/Threadpool.cpp index be0075c..c06b7c2 100644 --- a/RayTracer/tools/Threadpool.cpp +++ b/RayTracer/tools/Threadpool.cpp @@ -6,7 +6,7 @@ Threadpool::Threadpool(size_t n) : alive(true) { // Create the specified number of threads threads.reserve(n); for (int i = 0; i < n; ++i) { - threads.emplace_back(std::bind(&Threadpool::threading, this, i)); + threads.emplace_back(std::bind(&Threadpool::threading, this)); } } @@ -26,7 +26,7 @@ void Threadpool::queueTask(std::function<void(void)> task) { cv.notify_one(); } -void Threadpool::threading(int i) { +void Threadpool::threading() { while (true) { std::unique_lock<std::mutex> lock(m); while (alive && q.empty()) { diff --git a/RayTracer/tools/Threadpool.h b/RayTracer/tools/Threadpool.h index 9bdea12..20e6ee7 100644 --- a/RayTracer/tools/Threadpool.h +++ b/RayTracer/tools/Threadpool.h @@ -16,7 +16,7 @@ class Threadpool { void queueTask(std::function<void(void)> task); protected: - void threading(int i); + void threading(); private: std::vector<std::thread> threads; -- GitLab