1
0
mirror of https://github.com/Icinga/icinga2.git synced 2025-04-08 17:05:25 +02:00

Fix race condition in the config validator.

Fixes 
This commit is contained in:
Gunnar Beutner 2014-02-05 09:24:26 +01:00
parent 1728095c53
commit c818d94d93
2 changed files with 10 additions and 0 deletions

@ -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<ConfigCompilerMessage> 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();
}

@ -53,6 +53,8 @@ public:
private:
std::vector<ConfigCompilerMessage> m_Messages;
mutable boost::mutex m_Mutex;
};
}