lidavidm commented on a change in pull request #10482:
URL: https://github.com/apache/arrow/pull/10482#discussion_r649348454



##########
File path: cpp/src/arrow/util/parallel.h
##########
@@ -44,6 +45,25 @@ Status ParallelFor(int num_tasks, FUNCTION&& func,
   return st;
 }
 
+template <class FUNCTION, typename T,
+          typename R = typename 
internal::call_traits::return_type<FUNCTION>::ValueType>
+Future<std::vector<R>> ParallelForAsync(
+    std::vector<T> inputs, FUNCTION&& func,

Review comment:
       Yes: the callback of the sync version can safely and easily capture 
references to local stack variables. But the async version cannot. Rather than 
mess around with wrapping state in a shared_ptr, it's easier to just pass a 
vector. I can rename this to `ParallelForEachAsync` though to make it clearer.




-- 
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:
[email protected]


Reply via email to