1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-23 05:29:23 +00:00

Ensures perform_parallel doesn't lock up if all machines complete prior to reaching condition.wait.

This commit is contained in:
Thomas Harte 2018-02-11 21:06:51 -05:00
parent 6b8c223804
commit 7ea4ca00dc

View File

@ -42,7 +42,7 @@ void MultiCRTMachine::perform_parallel(const std::function<void(::CRTMachine::Ma
}
std::unique_lock<std::mutex> lock(mutex);
condition.wait(lock, [&outstanding_machines] { return !outstanding_machines; });
if(outstanding_machines) condition.wait(lock, [&outstanding_machines] { return !outstanding_machines; });
}
void MultiCRTMachine::perform_serial(const std::function<void (::CRTMachine::Machine *)> &function) {