bkietz commented on a change in pull request #8240:
URL: https://github.com/apache/arrow/pull/8240#discussion_r492829401



##########
File path: cpp/src/arrow/util/thread_pool.cc
##########
@@ -168,9 +174,11 @@ Status ThreadPool::SetCapacity(int threads) {
   CollectFinishedWorkersUnlocked();
 
   state_->desired_capacity_ = threads;
-  int diff = static_cast<int>(threads - state_->workers_.size());
-  if (diff > 0) {
-    LaunchWorkersUnlocked(diff);
+  const int diff = threads - static_cast<int>(state_->workers_.size());

Review comment:
       Maybe easier to read?
   ```suggestion
     const int required = static_cast<int>(std::min(
       threads - state_->workers_.size(),
       state_->pending_tasks_.size()));
   ```

##########
File path: cpp/src/arrow/util/thread_pool.h
##########
@@ -182,8 +182,12 @@ class ARROW_EXPORT ThreadPool : public Executor {
   int GetCapacity() override;
 
   // Dynamically change the number of worker threads.
-  // This function returns quickly, but it may take more time before the
-  // thread count is fully adjusted.
+  //
+  // This function always returns immediately.
+  // If less threads are running than this number, new threads are spawned

Review comment:
       ```suggestion
     // If fewer threads are running than this number, new threads are spawned
   ```




----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to