mirror of
https://github.com/gabime/spdlog.git
synced 2024-12-25 18:11:33 +08:00
removed message_counter from tp
This commit is contained in:
parent
5833c1dec8
commit
7d975de193
@ -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:
|
|||||||
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:
|
|||||||
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user