Fixed thread pool problem.

This commit is contained in:
yhirose 2019-08-06 08:31:43 +09:00
parent 1b95bf8cc3
commit 3629f87627

View File

@ -335,6 +335,8 @@ private:
void operator()() {
for (;;) {
std::function<void()> fn;
{
std::unique_lock<std::mutex> lock(pool_.mutex_);
pool_.cond_.wait(
@ -342,8 +344,9 @@ private:
if (pool_.shutdown_) { break; }
auto fn = pool_.jobs_.front();
fn = pool_.jobs_.front();
pool_.jobs_.pop_front();
}
assert(true == (bool)fn);
fn();