File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -370,8 +370,7 @@ class ThreadPool : public TaskQueue {
370
370
public:
371
371
explicit ThreadPool (size_t n) : shutdown_(false ) {
372
372
while (n) {
373
- auto t = std::make_shared<std::thread>(worker (*this ));
374
- threads_.push_back (t);
373
+ threads_.emplace_back (worker (*this ));
375
374
n--;
376
375
}
377
376
}
@@ -395,8 +394,8 @@ class ThreadPool : public TaskQueue {
395
394
cond_.notify_all ();
396
395
397
396
// Join...
398
- for (auto t : threads_) {
399
- t-> join ();
397
+ for (auto & t : threads_) {
398
+ t. join ();
400
399
}
401
400
}
402
401
@@ -428,7 +427,7 @@ class ThreadPool : public TaskQueue {
428
427
};
429
428
friend struct worker ;
430
429
431
- std::vector<std::shared_ptr<std:: thread> > threads_;
430
+ std::vector<std::thread> threads_;
432
431
std::list<std::function<void ()>> jobs_;
433
432
434
433
bool shutdown_;
You can’t perform that action at this time.
0 commit comments