From 2d1e1aa5ff3a855d5cf3bf6f7e7889125673b10f Mon Sep 17 00:00:00 2001 From: Maksim Andrianov Date: Wed, 16 Jan 2019 19:11:10 +0300 Subject: [PATCH] ThreadPool changed from 3party/ThreadPool to PrimitiveThreadPool. --- generator/popularity.cpp | 7 +++---- generator/regions/regions_builder.cpp | 7 +++---- generator/regions/regions_builder.hpp | 7 +++---- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/generator/popularity.cpp b/generator/popularity.cpp index b171ec47dd..2fafd53376 100644 --- a/generator/popularity.cpp +++ b/generator/popularity.cpp @@ -11,6 +11,7 @@ #include "base/assert.hpp" #include "base/geo_object_id.hpp" +#include "base/primitive_thread_pool.hpp" #include #include @@ -18,8 +19,6 @@ #include #include -#include "3party/ThreadPool/ThreadPool.h" - namespace generator { namespace popularity @@ -269,11 +268,11 @@ std::vector BuildPopularitySrcFromAllData(std::vector>> futures; for (auto const & filename : dataFilenames) { - auto result = threadPool.enqueue( + auto result = threadPool.Submit( static_cast(*)(std::string const &)>(BuildPopularitySrcFromData), filename); futures.emplace_back(std::move(result)); diff --git a/generator/regions/regions_builder.cpp b/generator/regions/regions_builder.cpp index cb4e3eaa3c..8715002102 100644 --- a/generator/regions/regions_builder.cpp +++ b/generator/regions/regions_builder.cpp @@ -1,6 +1,7 @@ #include "generator/regions/regions_builder.hpp" #include "base/assert.hpp" +#include "base/primitive_thread_pool.hpp" #include "base/stl_helpers.hpp" #include @@ -12,8 +13,6 @@ #include #include -#include "3party/ThreadPool/ThreadPool.h" - namespace generator { namespace regions @@ -32,7 +31,7 @@ Node::Ptr ShrinkToFit(Node::Ptr p) RegionsBuilder::RegionsBuilder(Regions && regions, std::unique_ptr toStringPolicy, - int cpuCount) + size_t cpuCount) : m_toStringPolicy(std::move(toStringPolicy)) , m_regions(std::move(regions)) , m_cpuCount(cpuCount) @@ -48,7 +47,7 @@ RegionsBuilder::RegionsBuilder(Regions && regions, std::sort(std::begin(m_countries), std::end(m_countries), cmp); } -RegionsBuilder::RegionsBuilder(Regions && regions, int cpuCount) +RegionsBuilder::RegionsBuilder(Regions && regions, size_t cpuCount) : RegionsBuilder(std::move(regions), std::make_unique(), cpuCount) {} RegionsBuilder::Regions const & RegionsBuilder::GetCountries() const diff --git a/generator/regions/regions_builder.hpp b/generator/regions/regions_builder.hpp index 4f5a573fb0..f3930af88f 100644 --- a/generator/regions/regions_builder.hpp +++ b/generator/regions/regions_builder.hpp @@ -27,8 +27,8 @@ public: explicit RegionsBuilder(Regions && regions, std::unique_ptr toStringPolicy, - int cpuCount = -1); - explicit RegionsBuilder(Regions && regions, int cpuCount = -1); + size_t cpuCount = 1); + explicit RegionsBuilder(Regions && regions, size_t cpuCount = 1); Regions const & GetCountries() const; StringsList GetCountryNames() const; @@ -42,8 +42,7 @@ private: std::unique_ptr m_toStringPolicy; Regions m_countries; - Regions m_regions; - int m_cpuCount; + size_t m_cpuCount; }; } // namespace regions } // namespace generator