From: James Sedgwick Date: Tue, 18 Nov 2014 18:05:10 +0000 (-0800) Subject: top-level via() X-Git-Tag: v0.22.0~165 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=6d8f063dcd952c6198f7312f5a9e01e928a8d84d;p=folly.git 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 --- diff --git a/folly/wangle/Future-inl.h b/folly/wangle/Future-inl.h index a1b8d0c5..06d225b0 100644 --- a/folly/wangle/Future-inl.h +++ b/folly/wangle/Future-inl.h @@ -423,6 +423,12 @@ inline Future makeFuture(Try&& t) { } } +// via +template +Future via(Executor* executor) { + return makeFuture().via(executor); +} + // when (variadic) template diff --git a/folly/wangle/Future.h b/folly/wangle/Future.h index c01aff5c..e169865b 100644 --- a/folly/wangle/Future.h +++ b/folly/wangle/Future.h @@ -401,6 +401,17 @@ makeFuture(E const& e); template Future makeFuture(Try&& 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 +Future 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