Agora
1.2.0
Agora project
|
Go to the documentation of this file.
6 #ifndef SPDLOG_HEADER_ONLY
20 if (threads_n == 0 || threads_n > 1000)
22 throw_spdlog_ex(
"spdlog::thread_pool(): invalid threads_n param (valid "
25 for (
size_t i = 0;
i < threads_n;
i++)
27 threads_.emplace_back([
this, on_thread_start, on_thread_stop] {
36 :
thread_pool(q_max_items, threads_n, on_thread_start, [] {})
41 q_max_items, threads_n, [] {}, [] {})
106 bool dequeued =
q_.
dequeue_for(incoming_async_msg, std::chrono::seconds(10));
112 switch (incoming_async_msg.
msg_type)
115 incoming_async_msg.
worker_ptr->backend_sink_it_(incoming_async_msg);
119 incoming_async_msg.
worker_ptr->backend_flush_();
void post_log(async_logger_ptr &&worker_ptr, const details::log_msg &msg, async_overflow_policy overflow_policy)
Definition: thread_pool-inl.h:62
async_msg_type msg_type
Definition: thread_pool.h:34
size_t queue_size()
Definition: thread_pool-inl.h:78
void post_flush(async_logger_ptr &&worker_ptr, async_overflow_policy overflow_policy)
Definition: thread_pool-inl.h:68
size_t overrun_counter()
Definition: thread_pool-inl.h:73
size_t overrun_counter()
Definition: mpmc_blocking_q.h:107
std::shared_ptr< spdlog::async_logger > async_logger_ptr
Definition: thread_pool.h:21
#define SPDLOG_CATCH_STD
Definition: common.h:104
Definition: thread_pool.h:81
std::vector< std::thread > threads_
Definition: thread_pool.h:105
SPDLOG_INLINE void throw_spdlog_ex(const std::string &msg, int last_errno)
Definition: common-inl.h:72
thread_pool(size_t q_max_items, size_t threads_n, std::function< void()> on_thread_start, std::function< void()> on_thread_stop)
Definition: thread_pool-inl.h:16
size_t size()
Definition: mpmc_blocking_q.h:113
for i
Definition: generate_data.m:107
bool dequeue_for(T &popped_item, std::chrono::milliseconds wait_duration)
Definition: mpmc_blocking_q.h:54
#define SPDLOG_INLINE
Definition: common.h:42
Definition: thread_pool.h:32
async_logger_ptr worker_ptr
Definition: thread_pool.h:35
void worker_loop_()
Definition: thread_pool-inl.h:95
function[avg_proc_duration, std_proc_duration]
Definition: parse_dl_file.m:1
q_type q_
Definition: thread_pool.h:103
bool process_next_msg_()
Definition: thread_pool-inl.h:103
void enqueue(T &&item)
Definition: mpmc_blocking_q.h:32
#define SPDLOG_TRY
Definition: common.h:102
void post_async_msg_(async_msg &&new_msg, async_overflow_policy overflow_policy)
Definition: thread_pool-inl.h:83
~thread_pool()
Definition: thread_pool-inl.h:45
async_overflow_policy
Definition: async_logger.h:22
void enqueue_nowait(T &&item)
Definition: mpmc_blocking_q.h:43