You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/10/07 07:40:50 UTC

[GitHub] [arrow] pitrou commented on a diff in pull request #14339: ARROW-17927: [C++] Changed SleepABitAsync to use a thread pool to reduce the # of threads required

pitrou commented on code in PR #14339:
URL: https://github.com/apache/arrow/pull/14339#discussion_r989787914


##########
cpp/src/arrow/testing/gtest_util.cc:
##########
@@ -767,22 +769,20 @@ void BusyWait(double seconds, std::function<bool()> predicate) {
   }
 }
 
-Future<> SleepAsync(double seconds) {
-  auto out = Future<>::Make();
-  std::thread([out, seconds]() mutable {
-    SleepFor(seconds);
-    out.MarkFinished();
-  }).detach();
-  return out;
+// These threads will spend most of their time sleeping so there
+// is no need to base this on the # of cores.  Instead it should be
+// high enough to ensure good concurrency when there is concurrent hardware
+static constexpr int kNumSleepThreads = 32;
+
+std::shared_ptr<ThreadPool> CreateSleepThreadPool() {

Review Comment:
   Nit: `static`?



-- 
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-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org