Commit 6d8f063d authored by James Sedgwick's avatar James Sedgwick Committed by Dave Watson

top-level via()

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
parent df3064cf
...@@ -423,6 +423,12 @@ inline Future<void> makeFuture(Try<void>&& t) { ...@@ -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) // when (variadic)
template <typename... Fs> template <typename... Fs>
......
...@@ -401,6 +401,17 @@ makeFuture(E const& e); ...@@ -401,6 +401,17 @@ makeFuture(E const& e);
template <class T> template <class T>
Future<T> makeFuture(Try<T>&& 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. /** When all the input Futures complete, the returned Future will complete.
Errors do not cause early termination; this Future will always succeed Errors do not cause early termination; this Future will always succeed
after all its Futures have finished (whether successfully or with an after all its Futures have finished (whether successfully or with an
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment