Commit 7d975de1 authored by gabime's avatar gabime

removed message_counter from tp

parent 5833c1de
...@@ -87,9 +87,8 @@ public: ...@@ -87,9 +87,8 @@ public:
using q_type = details::mpmc_blocking_queue<item_type>; using q_type = details::mpmc_blocking_queue<item_type>;
using clock_type = std::chrono::steady_clock; using clock_type = std::chrono::steady_clock;
thread_pool(size_t q_size_bytes, size_t threads_n) thread_pool(size_t q_max_items, size_t threads_n)
: msg_counter_(0) : q_(q_max_items)
, q_(q_size_bytes)
{ {
// std::cout << "thread_pool() q_size_bytes: " << q_size_bytes << "\tthreads_n: " << threads_n << std::endl; // std::cout << "thread_pool() q_size_bytes: " << q_size_bytes << "\tthreads_n: " << threads_n << std::endl;
if (threads_n == 0 || threads_n > 1000) if (threads_n == 0 || threads_n > 1000)
...@@ -134,13 +133,7 @@ public: ...@@ -134,13 +133,7 @@ public:
post_async_msg(async_msg(std::move(worker_ptr), async_msg_type::flush), overflow_policy); post_async_msg(async_msg(std::move(worker_ptr), async_msg_type::flush), overflow_policy);
} }
size_t msg_counter()
{
return msg_counter_.load(std::memory_order_relaxed);
}
private: private:
std::atomic<size_t> msg_counter_; // total # of messages processed in this pool
q_type q_; q_type q_;
std::vector<std::thread> threads_; std::vector<std::thread> threads_;
...@@ -191,7 +184,6 @@ private: ...@@ -191,7 +184,6 @@ private:
log_msg msg; log_msg msg;
incoming_async_msg.to_log_msg(std::move(msg)); incoming_async_msg.to_log_msg(std::move(msg));
incoming_async_msg.worker_ptr->_backend_log(msg); incoming_async_msg.worker_ptr->_backend_log(msg);
msg_counter_.fetch_add(1, std::memory_order_relaxed);
return true; return true;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment