3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2026-04-15 16:54:12 +00:00

Merge pull request #5794 from rocallahan/dispatch-pool-destruction

Fix data race in ParallelDispatchThreadPool destruction
This commit is contained in:
nella 2026-04-09 09:57:25 +00:00 committed by GitHub
commit a54bca5493
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -232,7 +232,6 @@ private:
}
void run_worker(int thread_num);
std::unique_ptr<ThreadPool> thread_pool;
std::function<void(const RunCtx &)> *current_work = nullptr;
// Keeps a correct count even when threads are exiting.
int num_worker_threads_;
@ -291,6 +290,10 @@ private:
done_workers.store(0, std::memory_order_relaxed);
}
#endif
// Ensure `thread_pool` is destroyed before any other members,
// forcing all threads to be joined before destroying the
// members (e.g. workers_to_main_signal_mutex) they might be using.
std::unique_ptr<ThreadPool> thread_pool;
};
template <class T>