Skip to content

Commit ee1f6e9

Browse files
committed
condition variable loop removed
Just initial check required, every notify (task added/thread stopped) makes further checks useless
1 parent b2ac0d7 commit ee1f6e9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ThreadPool.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ class ThreadPool {
5959

6060
{
6161
std::unique_lock<std::mutex> lock(this->queue_mutex);
62-
this->condition.wait(lock,
63-
[this]{ return this->stop || !this->tasks.empty(); });
62+
if(!this->stop && this->tasks.empty())
63+
this->condition.wait(lock);
6464
if(this->stop && this->tasks.empty())
6565
return;
6666
task = std::move(this->tasks.front());

0 commit comments

Comments
 (0)