We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents a3fa6ef + e4bc4dc commit 110bee8Copy full SHA for 110bee8
src/backend/evaluator/simulator/threadPool.h
@@ -71,8 +71,12 @@ class ThreadPool {
71
if (new_count < cur) {
72
size_t kill = cur - new_count;
73
waitForCompletion();
74
- for (size_t i = 0; i < kill; ++i)
75
- workers[workers.size() - 1 - i]->retire.store(true, std::memory_order_relaxed);
+ {
+ std::lock_guard<std::mutex> lock(mtx);
76
+ for (size_t i = 0; i < kill; ++i) {
77
+ workers[workers.size() - 1 - i]->retire.store(true, std::memory_order_relaxed);
78
+ }
79
80
cv.notify_all(); // wake sleepers so they can retire
81
for (size_t i = 0; i < kill; ++i) {
82
auto idx = workers.size() - 1;
0 commit comments