diff --git a/lib/config/configcompilercontext.cpp b/lib/config/configcompilercontext.cpp index 1ebded614..380fc242d 100644 --- a/lib/config/configcompilercontext.cpp +++ b/lib/config/configcompilercontext.cpp @@ -27,16 +27,22 @@ using namespace icinga; void ConfigCompilerContext::AddMessage(bool error, const String& message) { + boost::mutex::scoped_lock lock(m_Mutex); + m_Messages.push_back(ConfigCompilerMessage(error, message)); } std::vector ConfigCompilerContext::GetMessages(void) const { + boost::mutex::scoped_lock lock(m_Mutex); + return m_Messages; } bool ConfigCompilerContext::HasErrors(void) const { + boost::mutex::scoped_lock lock(m_Mutex); + BOOST_FOREACH(const ConfigCompilerMessage& message, m_Messages) { if (message.Error) return true; @@ -47,6 +53,8 @@ bool ConfigCompilerContext::HasErrors(void) const void ConfigCompilerContext::Reset(void) { + boost::mutex::scoped_lock lock(m_Mutex); + m_Messages.clear(); } diff --git a/lib/config/configcompilercontext.h b/lib/config/configcompilercontext.h index 0194f7a79..a9f43b60f 100644 --- a/lib/config/configcompilercontext.h +++ b/lib/config/configcompilercontext.h @@ -53,6 +53,8 @@ public: private: std::vector m_Messages; + + mutable boost::mutex m_Mutex; }; }