progschj / ThreadPool

A simple C++11 Thread Pool implementation
zlib License
7.64k stars 2.21k forks source link

Could change var name "task" at line 70 to "task_ptr"? #26

Closed RonTang closed 9 years ago

RonTang commented 9 years ago

First time,I read this code,I have mistaken task is packaged_task at this line auto task = std::make_shared< std::packaged_task<return_type()> >(std::bind(std::forward(f), std::forward(args)...));.

And I worry about whether this line task = std::move(this->tasks.front()); exception safe.At here task is a callable type.I spend many time on reading this line ,tasks.emplace([task](){ (*task)(); }); then I found at here task is shared_ptr.

This is a suggestion. Thanks everyone.