diff options
author | Maksim Andrianov <maksimandrianov1@gmail.com> | 2019-01-24 17:40:14 +0300 |
---|---|---|
committer | mpimenov <mpimenov@users.noreply.github.com> | 2019-01-29 17:29:17 +0300 |
commit | db2b3db1866a0aa3f798b27d5c9b6fa0b695acc6 (patch) | |
tree | ec10a77cebfca2c31abf8c6872fc94613c9c08f9 /platform | |
parent | ab205eeae163a8b80ed2de3945a33247a7895058 (diff) |
Refactored thead pools
Diffstat (limited to 'platform')
-rw-r--r-- | platform/platform.cpp | 6 | ||||
-rw-r--r-- | platform/platform.hpp | 10 | ||||
-rw-r--r-- | platform/platform_tests/apk_test.cpp | 4 | ||||
-rw-r--r-- | platform/platform_tests_support/async_gui_thread.hpp | 6 |
4 files changed, 13 insertions, 13 deletions
diff --git a/platform/platform.cpp b/platform/platform.cpp index 9303d4ad86..1ef6edaf48 100644 --- a/platform/platform.cpp +++ b/platform/platform.cpp @@ -344,9 +344,9 @@ void Platform::ShutdownThreads() void Platform::RunThreads() { ASSERT(!m_networkThread && !m_fileThread && !m_backgroundThread, ()); - m_networkThread = make_unique<base::WorkerThread>(); - m_fileThread = make_unique<base::WorkerThread>(); - m_backgroundThread = make_unique<base::WorkerThread>(); + m_networkThread = make_unique<base::thread_pool::delayed::ThreadPool>(); + m_fileThread = make_unique<base::thread_pool::delayed::ThreadPool>(); + m_backgroundThread = make_unique<base::thread_pool::delayed::ThreadPool>(); } string DebugPrint(Platform::EError err) diff --git a/platform/platform.hpp b/platform/platform.hpp index 3f832bcd07..4b18ff46f7 100644 --- a/platform/platform.hpp +++ b/platform/platform.hpp @@ -12,7 +12,7 @@ #include "base/exception.hpp" #include "base/macros.hpp" #include "base/task_loop.hpp" -#include "base/worker_thread.hpp" +#include "base/thread_pool_delayed.hpp" #include <cstdint> #include <memory> @@ -128,9 +128,9 @@ protected: std::unique_ptr<base::TaskLoop> m_guiThread; - std::unique_ptr<base::WorkerThread> m_networkThread; - std::unique_ptr<base::WorkerThread> m_fileThread; - std::unique_ptr<base::WorkerThread> m_backgroundThread; + std::unique_ptr<base::thread_pool::delayed::ThreadPool> m_networkThread; + std::unique_ptr<base::thread_pool::delayed::ThreadPool> m_fileThread; + std::unique_ptr<base::thread_pool::delayed::ThreadPool> m_backgroundThread; platform::BatteryLevelTracker m_batteryTracker; @@ -330,7 +330,7 @@ public: } template <typename Task> - void RunDelayedTask(Thread thread, base::WorkerThread::Duration const & delay, Task && task) + void RunDelayedTask(Thread thread, base::thread_pool::delayed::ThreadPool::Duration const & delay, Task && task) { ASSERT(m_networkThread && m_fileThread && m_backgroundThread, ()); switch (thread) diff --git a/platform/platform_tests/apk_test.cpp b/platform/platform_tests/apk_test.cpp index 6305aa9dba..83760b4e24 100644 --- a/platform/platform_tests/apk_test.cpp +++ b/platform/platform_tests/apk_test.cpp @@ -6,11 +6,11 @@ #include "coding/internal/file_data.hpp" #include "base/thread.hpp" +#include "base/thread_pool.hpp" #include "base/logging.hpp" #include "std/numeric.hpp" - namespace { char const * arrFiles[] = { @@ -103,7 +103,7 @@ UNIT_TEST(ApkReader_Multithreaded) srand(static_cast<unsigned>(size)); size_t const count = 20; - threads::SimpleThreadPool pool(count); + base::thread_pool::routine_simple::ThreadPool pool(count); for (size_t i = 0; i < count; ++i) pool.Add(make_unique<ApkTester>(path)); diff --git a/platform/platform_tests_support/async_gui_thread.hpp b/platform/platform_tests_support/async_gui_thread.hpp index c77f95f58c..43b8a3bc6e 100644 --- a/platform/platform_tests_support/async_gui_thread.hpp +++ b/platform/platform_tests_support/async_gui_thread.hpp @@ -3,7 +3,7 @@ #include "platform/gui_thread.hpp" #include "platform/platform.hpp" -#include "base/worker_thread.hpp" +#include "base/thread_pool_delayed.hpp" #include <memory> @@ -16,8 +16,8 @@ class AsyncGuiThread public: AsyncGuiThread() { - GetPlatform().SetGuiThread(std::make_unique<base::WorkerThread>( - 1 /* threadsCount */, base::WorkerThread::Exit::ExecPending)); + GetPlatform().SetGuiThread(std::make_unique<base::thread_pool::delayed::ThreadPool>( + 1 /* threadsCount */, base::thread_pool::delayed::ThreadPool::Exit::ExecPending)); } virtual ~AsyncGuiThread() |