bkietz commented on a change in pull request #10397: URL: https://github.com/apache/arrow/pull/10397#discussion_r660110016
########## File path: cpp/src/arrow/util/future.h ########## @@ -976,4 +979,43 @@ Future<BreakValueType> Loop(Iterate iterate) { return break_fut; } +template <typename T> +struct EnsureFuture { + using type = Future<T>; +}; + +template <typename T> +struct EnsureFuture<Result<T>> { + using type = Future<T>; +}; + +template <typename T> +struct EnsureFuture<Future<T>> { + using type = Future<T>; +}; + +template <> +struct EnsureFuture<Status> { + using type = Future<>; +}; Review comment: Nice ########## File path: cpp/src/arrow/util/thread_pool_test.cc ########## @@ -395,6 +395,22 @@ TEST_F(TestThreadPool, StressSpawn) { SpawnAdds(pool.get(), 1000, task_add<int>); } +TEST_F(TestThreadPool, OwnsCurrentThread) { + auto pool = this->MakeThreadPool(30); + std::atomic<bool> one_failed{false}; + + for (int i = 0; i < 1000; ++i) { + ASSERT_OK(pool->Spawn([&] { + if (pool->OwnsThisThread()) return; + + one_failed = true; + })); + } + + ASSERT_OK(pool->Shutdown()); + ASSERT_FALSE(one_failed); Review comment: will do -- 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: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org