From 5ad39a87358ee6330224cbaad002108c34f8a960 Mon Sep 17 00:00:00 2001 From: Dominik Gleich Date: Tue, 23 Jan 2018 11:28:03 +0100 Subject: [PATCH] Fix ExecuteOnWorkers Reviewers: florijan Reviewed By: florijan Differential Revision: https://phabricator.memgraph.io/D1132 --- src/distributed/rpc_worker_clients.hpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/distributed/rpc_worker_clients.hpp b/src/distributed/rpc_worker_clients.hpp index e5ed4e669..b0e3af8c5 100644 --- a/src/distributed/rpc_worker_clients.hpp +++ b/src/distributed/rpc_worker_clients.hpp @@ -56,8 +56,10 @@ class RpcWorkerClients { std::vector> futures; for (auto &client : clients_) { if (client.first == skip_worker_id) continue; + futures.emplace_back( - std::async(std::launch::async, execute(client.second))); + std::async(std::launch::async, + [&execute, &client]() { return execute(client.second); })); } return futures; }