pitrou commented on a change in pull request #10401:
URL: https://github.com/apache/arrow/pull/10401#discussion_r648544911
##########
File path: cpp/src/arrow/util/thread_pool_test.cc
##########
@@ -452,6 +454,42 @@ TEST_F(TestThreadPool, QuickShutdown) {
add_tester.CheckNotAllComputed();
}
+TEST_F(TestThreadPool, DestroyWithoutShutdown) {
+ std::mutex mx;
+ std::condition_variable cv;
+ std::weak_ptr<ThreadPool> weak_pool;
+ bool ready = false;
+ bool completed = false;
+ {
+ auto pool = this->MakeThreadPool(1);
+ weak_pool = pool;
+ // Simulate Windows
+ pool->shutdown_on_destroy_ = false;
+
+ ASSERT_OK(pool->Spawn([&mx, &cv, &completed, &ready] {
+ std::unique_lock<std::mutex> lock(mx);
+ ready = true;
+ cv.notify_one();
Review comment:
Yes, you should probably use two different predicates and booleans.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]