westonpace commented on a change in pull request #9095:
URL: https://github.com/apache/arrow/pull/9095#discussion_r565970329



##########
File path: cpp/src/arrow/util/thread_pool.h
##########
@@ -87,6 +87,21 @@ class ARROW_EXPORT Executor {
     return SpawnReal(hints, std::forward<Function>(func));
   }
 
+  template <typename T>
+  Future<T> Transfer(Future<T> future) {
+    auto transferred = Future<T>::Make();
+    future.AddCallback([this, transferred](const Result<T>& result) mutable {
+      Result<T> result_copy(result);
+      auto spawn_status = Spawn([transferred, result_copy]() mutable {

Review comment:
       Just to elaborate.  A future can have multiple callbacks so it provides 
a reference to the result.  No callback is allowed to steal the result.  I 
think I previously discussed we could introduce the concept of a "final 
callback" which gets the moved result and not a reference.




----------------------------------------------------------------
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