mirror of https://github.com/Icinga/icinga2.git
Fix {Host,Service,User}Group::{Add,Remove}Member isn't thread-safe.
Fixes #5699
This commit is contained in:
parent
5e5c9285c9
commit
2b6529c424
|
@ -31,15 +31,18 @@ REGISTER_TYPE(HostGroup);
|
|||
|
||||
std::set<Host::Ptr> HostGroup::GetMembers(void) const
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_HostGroupMutex);
|
||||
return m_Members;
|
||||
}
|
||||
|
||||
void HostGroup::AddMember(const Host::Ptr& host)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_HostGroupMutex);
|
||||
m_Members.insert(host);
|
||||
}
|
||||
|
||||
void HostGroup::RemoveMember(const Host::Ptr& host)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_HostGroupMutex);
|
||||
m_Members.erase(host);
|
||||
}
|
||||
|
|
|
@ -43,6 +43,7 @@ public:
|
|||
void RemoveMember(const Host::Ptr& host);
|
||||
|
||||
private:
|
||||
mutable boost::mutex m_HostGroupMutex;
|
||||
std::set<Host::Ptr> m_Members;
|
||||
};
|
||||
|
||||
|
|
|
@ -32,15 +32,18 @@ REGISTER_TYPE(ServiceGroup);
|
|||
|
||||
std::set<Service::Ptr> ServiceGroup::GetMembers(void) const
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_ServiceGroupMutex);
|
||||
return m_Members;
|
||||
}
|
||||
|
||||
void ServiceGroup::AddMember(const Service::Ptr& service)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_ServiceGroupMutex);
|
||||
m_Members.insert(service);
|
||||
}
|
||||
|
||||
void ServiceGroup::RemoveMember(const Service::Ptr& service)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_ServiceGroupMutex);
|
||||
m_Members.erase(service);
|
||||
}
|
||||
|
|
|
@ -43,6 +43,7 @@ public:
|
|||
void RemoveMember(const Service::Ptr& service);
|
||||
|
||||
private:
|
||||
mutable boost::mutex m_ServiceGroupMutex;
|
||||
std::set<Service::Ptr> m_Members;
|
||||
};
|
||||
|
||||
|
|
|
@ -31,15 +31,18 @@ REGISTER_TYPE(UserGroup);
|
|||
|
||||
std::set<User::Ptr> UserGroup::GetMembers(void) const
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_UserGroupMutex);
|
||||
return m_Members;
|
||||
}
|
||||
|
||||
void UserGroup::AddMember(const User::Ptr& user)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_UserGroupMutex);
|
||||
m_Members.insert(user);
|
||||
}
|
||||
|
||||
void UserGroup::RemoveMember(const User::Ptr& user)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_UserGroupMutex);
|
||||
m_Members.erase(user);
|
||||
}
|
||||
|
|
|
@ -43,6 +43,7 @@ public:
|
|||
void RemoveMember(const User::Ptr& user);
|
||||
|
||||
private:
|
||||
mutable boost::mutex m_UserGroupMutex;
|
||||
std::set<User::Ptr> m_Members;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue