Fixed potential race condition in the non blocking thread pool

This commit is contained in:
Benoit Steiner
2016-05-12 11:45:48 -07:00
parent a071629fec
commit 2a54b70d45
2 changed files with 12 additions and 1 deletions

View File

@@ -58,7 +58,7 @@ class NonBlockingThreadPoolTempl : public Eigen::ThreadPoolInterface {
}
~NonBlockingThreadPoolTempl() {
done_.store(true, std::memory_order_relaxed);
done_ = true;
// Now if all threads block without work, they will start exiting.
// But note that threads can continue to work arbitrary long,
// block, submit new work, unblock and otherwise live full life.