Skip to content

Commit

Permalink
more2
Browse files Browse the repository at this point in the history
  • Loading branch information
filimonov committed Feb 6, 2024
1 parent 714b303 commit 5294d70
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Common/ThreadPool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -665,10 +665,14 @@ void ThreadPoolImpl<Thread>::worker(typename std::list<Thread>::iterator thread_
--scheduled_jobs;
calculateDesiredThreadPoolSizeNoLock();

job_finished.notify_one();

if (scheduled_jobs == 0)
{
job_finished.notify_all();
job_finished.notify_all(); // one of the threads can be waiting in wait() for that condition
}
else
{
job_finished.notify_one();
}
}

Expand Down

0 comments on commit 5294d70

Please sign in to comment.