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 2021/01/08 17:13:13 UTC

[GitHub] [arrow] bkietz commented on a change in pull request #9134: ARROW-10966: [C++] Use FnOnce for ThreadPool's tasks instead of std::function

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



##########
File path: cpp/src/arrow/util/thread_pool.cc
##########
@@ -84,10 +84,10 @@ static void WorkerLoop(std::shared_ptr<ThreadPool::State> state,
         break;
       }
       {
-        std::function<void()> task = std::move(state->pending_tasks_.front());
+        FnOnce<void()> task = std::move(state->pending_tasks_.front());
         state->pending_tasks_.pop_front();
         lock.unlock();
-        task();
+        std::move(task)();
       }

Review comment:
       since invoking task will drop its resources, we no longer need to wrap it in an explicit scope
   




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