Tom-Newton commented on code in PR #44897:
URL: https://github.com/apache/arrow/pull/44897#discussion_r1876327652
##########
cpp/src/arrow/util/thread_pool_test.cc:
##########
@@ -578,6 +578,57 @@ TEST_F(TestThreadPool, Spawn) {
SpawnAdds(pool.get(), 7, task_add<int>);
}
+TEST_F(TestThreadPool, TasksRunInPriorityOrder) {
+ auto pool = this->MakeThreadPool(1);
+ constexpr int kNumTasks = 10;
+ auto recorded_times =
std::vector<std::chrono::steady_clock::time_point>(kNumTasks);
+ auto futures = std::vector<Future<int>>(kNumTasks);
+ auto sleep_task = []() { SleepABit(); };
+
+ // Spawn a sleep task to block the pool while we add the other tasks. This
+ // ensures all the tasks are queued before any of them start running, so that
+ // their running order is fully determined by their priority.
+ ASSERT_OK(pool->Spawn(sleep_task));
Review Comment:
Done
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]