Skip to content
Snippets Groups Projects
Commit 281eea2e authored by Yoel's avatar Yoel
Browse files

Fixed threading function args, i is not needed

parent f2b403a8
No related branches found
No related tags found
No related merge requests found
...@@ -6,7 +6,7 @@ Threadpool::Threadpool(size_t n) : alive(true) { ...@@ -6,7 +6,7 @@ Threadpool::Threadpool(size_t n) : alive(true) {
// Create the specified number of threads // Create the specified number of threads
threads.reserve(n); threads.reserve(n);
for (int i = 0; i < n; ++i) { 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) { ...@@ -26,7 +26,7 @@ void Threadpool::queueTask(std::function<void(void)> task) {
cv.notify_one(); cv.notify_one();
} }
void Threadpool::threading(int i) { void Threadpool::threading() {
while (true) { while (true) {
std::unique_lock<std::mutex> lock(m); std::unique_lock<std::mutex> lock(m);
while (alive && q.empty()) { while (alive && q.empty()) {
......
...@@ -16,7 +16,7 @@ class Threadpool { ...@@ -16,7 +16,7 @@ class Threadpool {
void queueTask(std::function<void(void)> task); void queueTask(std::function<void(void)> task);
protected: protected:
void threading(int i); void threading();
private: private:
std::vector<std::thread> threads; std::vector<std::thread> threads;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment