31 log_clock::time_point
time;
46 #if defined(_MSC_VER) && _MSC_VER <= 1800
64 raw = std::move(other.raw);
70 #else // (_MSC_VER) && _MSC_VER <= 1800
129 if (threads_n == 0 || threads_n > 1000)
131 throw spdlog_ex(
"spdlog::thread_pool(): invalid threads_n param (valid "
134 for (
size_t i = 0; i < threads_n; i++)
136 threads_.emplace_back(&thread_pool::worker_loop_,
this);
145 for (
size_t i = 0; i < threads_.size(); i++)
150 for (
auto &t : threads_)
166 post_async_msg_(std::move(async_m), overflow_policy);
182 std::vector<std::thread> threads_;
188 q_.
enqueue(std::move(new_msg));
192 q_.enqueue_nowait(std::move(new_msg));
198 while (process_next_msg_()) {};
204 bool process_next_msg_()
206 async_msg incoming_async_msg;
207 bool dequeued = q_.dequeue_for(incoming_async_msg, std::chrono::seconds(10));
213 switch (incoming_async_msg.msg_type)
217 auto msg = incoming_async_msg.to_log_msg();
218 incoming_async_msg.worker_ptr->backend_log_(msg);
223 incoming_async_msg.worker_ptr->backend_flush_();
232 assert(
false &&
"Unexpected async_msg_type");