top-level via()
authorJames Sedgwick <jsedgwick@fb.com>
Tue, 18 Nov 2014 18:05:10 +0000 (10:05 -0800)
committerDave Watson <davejwatson@fb.com>
Wed, 19 Nov 2014 20:53:06 +0000 (12:53 -0800)
Summary: as discussed

Test Plan: compiles :)

Reviewed By: steveo@fb.com

Subscribers: fugalh, njormrod, folly-diffs@

FB internal diff: D1687921

Signature: t1:1687921:1416331366:4e58a69daf39797e0d456ba86a463a9da2fd0369

folly/wangle/Future-inl.h
folly/wangle/Future.h

index a1b8d0c52604de90114f6008fcf4d78553922872..06d225b02ade88f41cd7a69de21722fff8f01bb5 100644 (file)
@@ -423,6 +423,12 @@ inline Future<void> makeFuture(Try<void>&& t) {
   }
 }
 
+// via
+template <typename Executor>
+Future<void> via(Executor* executor) {
+  return makeFuture().via(executor);
+}
+
 // when (variadic)
 
 template <typename... Fs>
index c01aff5c11edc9d6d80d4f46fd439dd33766636d..e169865b75f286d898d6293b581733612bc83f46 100644 (file)
@@ -401,6 +401,17 @@ makeFuture(E const& e);
 template <class T>
 Future<T> makeFuture(Try<T>&& t);
 
+/*
+ * Return a new Future that will call back on the given Executor.
+ * This is just syntactic sugar for makeFuture().via(executor)
+ *
+ * @param executor the Executor to call back on
+ *
+ * @returns a void Future that will call back on the given executor
+ */
+template <typename Executor>
+Future<void> via(Executor* executor);
+
 /** When all the input Futures complete, the returned Future will complete.
   Errors do not cause early termination; this Future will always succeed
   after all its Futures have finished (whether successfully or with an