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 68f99d8 commit 42bed3aCopy full SHA for 42bed3a
ThreadPool.h
@@ -44,8 +44,8 @@ inline ThreadPool::ThreadPool(size_t threads)
44
45
{
46
std::unique_lock<std::mutex> lock(this->queue_mutex);
47
- while(!this->stop && this->tasks.empty())
48
- this->condition.wait(lock);
+ this->condition.wait(lock,
+ [this]{ return this->stop || !this->tasks.empty(); });
49
if(this->stop && this->tasks.empty())
50
return;
51
task = std::move(this->tasks.front());
0 commit comments