From 10895796b240113416b4bc5bd30002bea8601aaf Mon Sep 17 00:00:00 2001 From: Pablo Arias Date: Sat, 10 Nov 2018 16:55:35 +0100 Subject: [PATCH] Added mutexes to protect logger initialization and toggling automatic registration --- include/spdlog/details/registry.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/spdlog/details/registry.h b/include/spdlog/details/registry.h index f6bfe0bd..e22b8bbc 100644 --- a/include/spdlog/details/registry.h +++ b/include/spdlog/details/registry.h @@ -49,6 +49,7 @@ public: void initialize_logger(std::shared_ptr new_logger) { + std::lock_guard lock(logger_map_mutex_); new_logger->set_formatter(formatter_->clone()); if (err_handler_) @@ -222,6 +223,7 @@ public: void set_automatic_registration(bool automatic_regsistration) { + std::lock_guard lock(logger_map_mutex_); automatic_registration_ = automatic_regsistration; }