From fda2b361dadcf6842c1c5bc5c63df457c6950892 Mon Sep 17 00:00:00 2001 From: Philippe Serreault Date: Wed, 8 Dec 2021 16:33:56 +0100 Subject: [PATCH] Added missing global thread-pool initialization helper. --- include/spdlog/async.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/include/spdlog/async.h b/include/spdlog/async.h index e54fedc6..281af697 100644 --- a/include/spdlog/async.h +++ b/include/spdlog/async.h @@ -73,16 +73,20 @@ inline std::shared_ptr create_async_nb(std::string logger_name, } // set global thread pool. -inline void init_thread_pool(size_t q_size, size_t thread_count, std::function on_thread_start) +inline void init_thread_pool(size_t q_size, size_t thread_count, std::function on_thread_start, std::function on_thread_stop) { - auto tp = std::make_shared(q_size, thread_count, on_thread_start); + auto tp = std::make_shared(q_size, thread_count, on_thread_start, on_thread_stop); details::registry::instance().set_tp(std::move(tp)); } -// set global thread pool. +inline void init_thread_pool(size_t q_size, size_t thread_count, std::function on_thread_start) +{ + init_thread_pool(q_size, thread_count, on_thread_start, [] {}); +} + inline void init_thread_pool(size_t q_size, size_t thread_count) { - init_thread_pool(q_size, thread_count, [] {}); + init_thread_pool(q_size, thread_count, [] {}, [] {}); } // get the global thread pool.