From 1a258711b00cef322cadedf35540d64ae18eb0b0 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Sun, 28 Feb 2016 18:04:18 +0100 Subject: Guard log print to stderr with mutex --- src/Log.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/Log.cpp') diff --git a/src/Log.cpp b/src/Log.cpp index f8f7d7f..90548af 100644 --- a/src/Log.cpp +++ b/src/Log.cpp @@ -74,7 +74,10 @@ void Logger::logstr(log_level_t level, std::string message) (*it)->log(level, message); } - std::cerr << levels_as_str[level] << " " << message << std::endl; + { + std::lock_guard guard(m_cerr_mutex); + std::cerr << levels_as_str[level] << " " << message << std::endl; + } } -- cgit v1.2.3