bkietz commented on a change in pull request #8591:
URL: https://github.com/apache/arrow/pull/8591#discussion_r519870446
##########
File path: cpp/src/arrow/util/thread_pool.h
##########
@@ -64,14 +64,39 @@ namespace detail {
// Make sure that both functions returning T and Result<T> can be called
// through Executor::Submit(), and that a Future<T> is returned for both.
template <typename T>
-struct ExecutorResultTraits {
- using ValueType = T;
+struct ExecutorSubmitTraits {
+ using FutureType = Future<T>;
};
-
template <typename T>
-struct ExecutorResultTraits<Result<T>> {
- using ValueType = T;
+struct ExecutorSubmitTraits<Result<T>> {
+ using FutureType = Future<T>;
+};
+
+// Make sure that both functions returning Status and void can be called
+// through Executor::Submit(), and that a Future<> is returned for both.
+template <>
+struct ExecutorSubmitTraits<Status> {
+ using FutureType = Future<>;
};
+template <>
+struct ExecutorSubmitTraits<void> {
+ using FutureType = Future<>;
+};
+
+template <typename T, typename F>
+typename std::enable_if<
+ !std::is_same<typename std::result_of<F && ()>::type, void>::value>::type
+ExecuteAndMarkFinished(Future<T>* fut, F&& f) {
Review comment:
Since it's only used in Executor::Submit it seemed preferable to
simplify the public interface of `Future` by moving it here. It can certainly
be moved back if there's another application for it
----------------------------------------------------------------
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]