Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gabime/spdlog.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilippe Serreault <philippe.serreault@mosaicfinance.fr>2021-12-08 18:33:56 +0300
committerPhilippe Serreault <philippe.serreault@mosaicfinance.fr>2021-12-08 18:39:43 +0300
commit967b373d4e1477fe2e017d99137b4155a7b2f94f (patch)
tree27fe380d5a137bd1cb4adfb9acccd0cf97825ffc
parentd0a967ff5caf972e2d90e394283b9ec7e4baa9c5 (diff)
Added missing global thread-pool initialization helper.
-rw-r--r--include/spdlog/async.h12
1 files 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<spdlog::logger> 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<void()> on_thread_start)
+inline void init_thread_pool(size_t q_size, size_t thread_count, std::function<void()> on_thread_start, std::function<void()> on_thread_stop)
{
- auto tp = std::make_shared<details::thread_pool>(q_size, thread_count, on_thread_start);
+ auto tp = std::make_shared<details::thread_pool>(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<void()> 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.