summaryrefslogtreecommitdiff
path: root/src/mongo/transport/baton.h
diff options
context:
space:
mode:
authorMathias Stearn <mathias@10gen.com>2018-05-25 13:05:10 -0400
committerMathias Stearn <mathias@10gen.com>2018-05-25 18:46:13 -0400
commitf0e5229b631668c9bde511e607bf52fd871e582d (patch)
tree0141e574f53dab6361a69ce8bf0944c88fa381c6 /src/mongo/transport/baton.h
parentfa9d7223cf59ee1b5681ea129fe86f55c608c632 (diff)
downloadmongo-f0e5229b631668c9bde511e607bf52fd871e582d.tar.gz
SERVER-35234 makePromiseFuture<T>()
Diffstat (limited to 'src/mongo/transport/baton.h')
-rw-r--r--src/mongo/transport/baton.h7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/mongo/transport/baton.h b/src/mongo/transport/baton.h
index 59c2d7c06ab..65a9efbb7d8 100644
--- a/src/mongo/transport/baton.h
+++ b/src/mongo/transport/baton.h
@@ -70,14 +70,13 @@ public:
*/
template <typename Callback>
Future<FutureContinuationResult<Callback>> execute(Callback&& cb) {
- Promise<FutureContinuationResult<Callback>> promise;
- auto future = promise.getFuture();
+ auto pf = makePromiseFuture<FutureContinuationResult<Callback>>();
- schedule([ cb = std::forward<Callback>(cb), sp = promise.share() ]() mutable {
+ schedule([ cb = std::forward<Callback>(cb), sp = pf.promise.share() ]() mutable {
sp.setWith(std::move(cb));
});
- return future;
+ return std::move(pf.future);
}
/**