From dc7c29f7cc2405844d48c794e7a58fc9cc2ed4a7 Mon Sep 17 00:00:00 2001 From: Stephen Seo Date: Tue, 7 Sep 2021 12:24:27 +0900 Subject: [PATCH] Fix failing to wait for ThreadPool to finish --- src/EC/Manager.hpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/EC/Manager.hpp b/src/EC/Manager.hpp index 1160759..78277ea 100644 --- a/src/EC/Manager.hpp +++ b/src/EC/Manager.hpp @@ -695,7 +695,7 @@ namespace EC threadPool->wakeThreads(); do { std::this_thread::sleep_for(std::chrono::microseconds(200)); - } while(!threadPool->isQueueEmpty() && !threadPool->isAllThreadsWaiting()); + } while(!threadPool->isQueueEmpty() || !threadPool->isAllThreadsWaiting()); } } @@ -814,7 +814,7 @@ namespace EC threadPool->wakeThreads(); do { std::this_thread::sleep_for(std::chrono::microseconds(200)); - } while(!threadPool->isQueueEmpty() && !threadPool->isAllThreadsWaiting()); + } while(!threadPool->isQueueEmpty() || !threadPool->isAllThreadsWaiting()); } } @@ -958,7 +958,7 @@ namespace EC threadPool->wakeThreads(); do { std::this_thread::sleep_for(std::chrono::microseconds(200)); - } while(!threadPool->isQueueEmpty() && !threadPool->isAllThreadsWaiting()); + } while(!threadPool->isQueueEmpty() || !threadPool->isAllThreadsWaiting()); } }))); @@ -1037,7 +1037,7 @@ namespace EC threadPool->wakeThreads(); do { std::this_thread::sleep_for(std::chrono::microseconds(200)); - } while(!threadPool->isQueueEmpty() && !threadPool->isAllThreadsWaiting()); + } while(!threadPool->isQueueEmpty() || !threadPool->isAllThreadsWaiting()); } return matchingV; @@ -1424,7 +1424,7 @@ namespace EC threadPool->wakeThreads(); do { std::this_thread::sleep_for(std::chrono::microseconds(200)); - } while(!threadPool->isQueueEmpty() && !threadPool->isAllThreadsWaiting()); + } while(!threadPool->isQueueEmpty() || !threadPool->isAllThreadsWaiting()); } // call functions on matching entities @@ -1486,7 +1486,7 @@ namespace EC threadPool->wakeThreads(); do { std::this_thread::sleep_for(std::chrono::microseconds(200)); - } while(!threadPool->isQueueEmpty() && !threadPool->isAllThreadsWaiting()); + } while(!threadPool->isQueueEmpty() || !threadPool->isAllThreadsWaiting()); } } ); @@ -1625,7 +1625,7 @@ namespace EC threadPool->wakeThreads(); do { std::this_thread::sleep_for(std::chrono::microseconds(200)); - } while(!threadPool->isQueueEmpty() && !threadPool->isAllThreadsWaiting()); + } while(!threadPool->isQueueEmpty() || !threadPool->isAllThreadsWaiting()); } // call functions on matching entities @@ -1692,7 +1692,7 @@ namespace EC threadPool->wakeThreads(); do { std::this_thread::sleep_for(std::chrono::microseconds(200)); - } while(!threadPool->isQueueEmpty() && !threadPool->isAllThreadsWaiting()); + } while(!threadPool->isQueueEmpty() || !threadPool->isAllThreadsWaiting()); } } ); @@ -1765,7 +1765,7 @@ namespace EC threadPool->wakeThreads(); do { std::this_thread::sleep_for(std::chrono::microseconds(200)); - } while(!threadPool->isQueueEmpty() && !threadPool->isAllThreadsWaiting()); + } while(!threadPool->isQueueEmpty() || !threadPool->isAllThreadsWaiting()); } } @@ -1854,7 +1854,7 @@ namespace EC threadPool->wakeThreads(); do { std::this_thread::sleep_for(std::chrono::microseconds(200)); - } while(!threadPool->isQueueEmpty() && !threadPool->isAllThreadsWaiting()); + } while(!threadPool->isQueueEmpty() || !threadPool->isAllThreadsWaiting()); } } };