Clang format

This commit is contained in:
gabime
2023-09-24 20:43:14 +03:00
parent 5654205d6b
commit e28eadcd52
38 changed files with 326 additions and 356 deletions

View File

@@ -8,8 +8,7 @@
namespace spdlog {
namespace details {
thread_pool::thread_pool(
size_t q_max_items, size_t threads_n, std::function<void()> on_thread_start, std::function<void()> on_thread_stop)
thread_pool::thread_pool(size_t q_max_items, size_t threads_n, std::function<void()> on_thread_start, std::function<void()> on_thread_stop)
: q_(q_max_items)
{
if (threads_n == 0 || threads_n > 1000)
@@ -27,17 +26,17 @@ namespace details {
}
}
thread_pool::thread_pool(size_t q_max_items, size_t threads_n, std::function<void()> on_thread_start)
thread_pool::thread_pool(size_t q_max_items, size_t threads_n, std::function<void()> on_thread_start)
: thread_pool(q_max_items, threads_n, on_thread_start, [] {})
{}
thread_pool::thread_pool(size_t q_max_items, size_t threads_n)
thread_pool::thread_pool(size_t q_max_items, size_t threads_n)
: thread_pool(
q_max_items, threads_n, [] {}, [] {})
{}
// message all threads to terminate gracefully join them
thread_pool::~thread_pool()
thread_pool::~thread_pool()
{
SPDLOG_TRY
{
@@ -54,43 +53,43 @@ namespace details {
SPDLOG_CATCH_STD
}
void thread_pool::post_log(async_logger_ptr &&worker_ptr, const details::log_msg &msg, async_overflow_policy overflow_policy)
void thread_pool::post_log(async_logger_ptr &&worker_ptr, const details::log_msg &msg, async_overflow_policy overflow_policy)
{
async_msg async_m(std::move(worker_ptr), async_msg_type::log, msg);
post_async_msg_(std::move(async_m), overflow_policy);
}
void thread_pool::post_flush(async_logger_ptr &&worker_ptr, async_overflow_policy overflow_policy)
void thread_pool::post_flush(async_logger_ptr &&worker_ptr, async_overflow_policy overflow_policy)
{
post_async_msg_(async_msg(std::move(worker_ptr), async_msg_type::flush), overflow_policy);
}
size_t thread_pool::overrun_counter()
size_t thread_pool::overrun_counter()
{
return q_.overrun_counter();
}
void thread_pool::reset_overrun_counter()
void thread_pool::reset_overrun_counter()
{
q_.reset_overrun_counter();
}
size_t thread_pool::discard_counter()
size_t thread_pool::discard_counter()
{
return q_.discard_counter();
}
void thread_pool::reset_discard_counter()
void thread_pool::reset_discard_counter()
{
q_.reset_discard_counter();
}
size_t thread_pool::queue_size()
size_t thread_pool::queue_size()
{
return q_.size();
}
void thread_pool::post_async_msg_(async_msg &&new_msg, async_overflow_policy overflow_policy)
void thread_pool::post_async_msg_(async_msg &&new_msg, async_overflow_policy overflow_policy)
{
if (overflow_policy == async_overflow_policy::block)
{
@@ -107,7 +106,7 @@ void thread_pool::post_async_msg_(async_msg &&new_msg, async_overflow_policy ov
}
}
void thread_pool::worker_loop_()
void thread_pool::worker_loop_()
{
while (process_next_msg_()) {}
}
@@ -115,7 +114,7 @@ void thread_pool::worker_loop_()
// process next message in the queue
// return true if this thread should still be active (while no terminate msg
// was received)
bool thread_pool::process_next_msg_()
bool thread_pool::process_next_msg_()
{
async_msg incoming_async_msg;
q_.dequeue(incoming_async_msg);