diff options
author | Mathias Stearn <mathias@10gen.com> | 2018-05-25 13:05:10 -0400 |
---|---|---|
committer | Mathias Stearn <mathias@10gen.com> | 2018-08-17 12:01:07 -0400 |
commit | 869931050527d8d0b6955490bb972021151c00b1 (patch) | |
tree | 8df3bed043dfb1246216685404f287db8e899c2b /src/mongo/db/free_mon/http_client_winhttp.cpp | |
parent | 270c31f344e992f4027603b5f6802a6fc29eb69a (diff) | |
download | mongo-869931050527d8d0b6955490bb972021151c00b1.tar.gz |
SERVER-35234 makePromiseFuture<T>()
(cherry picked from commit f0e5229b631668c9bde511e607bf52fd871e582d)
Diffstat (limited to 'src/mongo/db/free_mon/http_client_winhttp.cpp')
-rw-r--r-- | src/mongo/db/free_mon/http_client_winhttp.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/mongo/db/free_mon/http_client_winhttp.cpp b/src/mongo/db/free_mon/http_client_winhttp.cpp index 4393562c5ab..144e05535b9 100644 --- a/src/mongo/db/free_mon/http_client_winhttp.cpp +++ b/src/mongo/db/free_mon/http_client_winhttp.cpp @@ -135,16 +135,14 @@ public: Future<std::vector<uint8_t>> postAsync(StringData url, const BSONObj obj) final { auto urlString = url.toString(); - Promise<std::vector<uint8_t>> promise; - auto future = promise.getFuture(); - auto shared_promise = promise.share(); - - uassertStatusOK(_executor->scheduleWork([shared_promise, urlString, obj]( - const executor::TaskExecutor::CallbackArgs& cbArgs) mutable { - doPost(shared_promise, urlString, obj); - })); - - return future; + auto pf = makePromiseFuture<std::vector<uint8_t>>(); + uassertStatusOK( + _executor->scheduleWork([ shared_promise = pf.promise.share(), urlString, obj ]( + const executor::TaskExecutor::CallbackArgs& cbArgs) mutable { + doPost(shared_promise, urlString, obj); + })); + + return std::move(pf.future); } private: |