From: Razvan Becheriu Date: Wed, 20 Nov 2019 11:26:42 +0000 (+0200) Subject: [#883, !506] use boost:: instead of std:: X-Git-Tag: Kea-1.7.2~34 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1ee6ab827cb7e2f403aa4d06c2014667993a4132;p=thirdparty%2Fkea.git [#883, !506] use boost:: instead of std:: --- diff --git a/src/lib/util/tests/thread_pool_unittest.cc b/src/lib/util/tests/thread_pool_unittest.cc index 7e209c097a..2c90bb2e0c 100644 --- a/src/lib/util/tests/thread_pool_unittest.cc +++ b/src/lib/util/tests/thread_pool_unittest.cc @@ -95,7 +95,7 @@ public: } // start test threads for (uint32_t i = 0; i < thread_count; ++i) { - threads_.push_back(make_shared(runFunction, this)); + threads_.push_back(boost::make_shared(runFunction, this)); } } @@ -185,7 +185,7 @@ private: map> history_; /// @brief the list of test threads - list> threads_; + list> threads_; }; /// @brief define CallBack type @@ -207,7 +207,7 @@ TEST_F(ThreadPoolTest, testAddAndCount) { // add items to stopped thread pool for (uint32_t i = 0; i < items_count; ++i) { - EXPECT_NO_THROW(thread_pool.add(make_shared(call_back))); + EXPECT_NO_THROW(thread_pool.add(boost::make_shared(call_back))); } // the item count should match @@ -273,7 +273,7 @@ TEST_F(ThreadPoolTest, testStartAndStop) { // add items to stopped thread pool for (uint32_t i = 0; i < items_count; ++i) { - EXPECT_NO_THROW(thread_pool.add(make_shared(call_back))); + EXPECT_NO_THROW(thread_pool.add(boost::make_shared(call_back))); } // the item count should match @@ -311,7 +311,7 @@ TEST_F(ThreadPoolTest, testStartAndStop) { // add items to running thread pool for (uint32_t i = 0; i < items_count; ++i) { - EXPECT_NO_THROW(thread_pool.add(make_shared(call_back))); + EXPECT_NO_THROW(thread_pool.add(boost::make_shared(call_back))); } // wait for all items to be processed @@ -351,7 +351,7 @@ TEST_F(ThreadPoolTest, testStartAndStop) { // add items to stopped thread pool for (uint32_t i = 0; i < items_count; ++i) { - EXPECT_NO_THROW(thread_pool.add(make_shared(call_back))); + EXPECT_NO_THROW(thread_pool.add(boost::make_shared(call_back))); } // the item count should match diff --git a/src/lib/util/thread_pool.h b/src/lib/util/thread_pool.h index 6016d6bb0c..5c89f95731 100644 --- a/src/lib/util/thread_pool.h +++ b/src/lib/util/thread_pool.h @@ -8,6 +8,8 @@ #define THREAD_POOL_H #include +#include +#include #include #include @@ -24,9 +26,9 @@ namespace util { /// /// @tparam WorkItem a functor /// @tparam Container a 'queue like' container -template >> +template >> struct ThreadPool { - typedef typename std::shared_ptr WorkItemPtr; + typedef typename boost::shared_ptr WorkItemPtr; /// @brief Constructor ThreadPool() : running_(false) { @@ -103,7 +105,7 @@ private: queue_.enable(); running_ = true; for (uint32_t i = 0; i < thread_count; ++i) { - threads_.push_back(std::make_shared(&ThreadPool::run, this)); + threads_.push_back(boost::make_shared(&ThreadPool::run, this)); } } @@ -253,7 +255,7 @@ private: } /// @brief list of worker threads - std::vector> threads_; + std::vector> threads_; /// @brief underlying work items queue ThreadPoolQueue queue_;