From 7cb28e88e21713598c97d122ddada7021b2cc7e2 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Fri, 6 Jun 2014 23:08:32 +0900 Subject: [PATCH] h2load: Return Stats rather than Worker from std::future --- src/h2load.cc | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/h2load.cc b/src/h2load.cc index a925839f..2c42557b 100644 --- a/src/h2load.cc +++ b/src/h2load.cc @@ -551,11 +551,11 @@ std::string get_reqline(const char *uri, const http_parser_url& u) } // namespace namespace { -std::unique_ptr run(std::unique_ptr worker) +Stats run(std::unique_ptr worker) { worker->run(); - return worker; + return worker->stats; } } // namespace @@ -898,7 +898,7 @@ int main(int argc, char **argv) std::cout << "starting benchmark..." << std::endl; - std::vector>> futures; + std::vector> futures; auto start = std::chrono::steady_clock::now(); std::vector> workers; @@ -924,8 +924,7 @@ int main(int argc, char **argv) worker.run(); for(auto& fut : futures) { - auto subworker = fut.get(); - auto& stats = subworker->stats; + auto stats = fut.get(); worker.stats.req_todo += stats.req_todo; worker.stats.req_started += stats.req_started;