mirror of https://github.com/Icinga/icinga2.git
parent
97ff17eb4e
commit
c61134d55a
|
@ -293,6 +293,8 @@ void DbObject::OnStatusUpdate(void)
|
|||
|
||||
DbObject::Ptr DbObject::GetOrCreateByObject(const DynamicObject::Ptr& object)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(GetStaticMutex());
|
||||
|
||||
DbObject::Ptr dbobj = object->GetExtension("DbObject");
|
||||
|
||||
if (dbobj)
|
||||
|
@ -326,11 +328,8 @@ DbObject::Ptr DbObject::GetOrCreateByObject(const DynamicObject::Ptr& object)
|
|||
|
||||
dbobj = dbtype->GetOrCreateObjectByName(name1, name2);
|
||||
|
||||
{
|
||||
ObjectLock olock(object);
|
||||
dbobj->SetObject(object);
|
||||
object->SetExtension("DbObject", dbobj);
|
||||
}
|
||||
dbobj->SetObject(object);
|
||||
object->SetExtension("DbObject", dbobj);
|
||||
|
||||
return dbobj;
|
||||
}
|
||||
|
@ -357,3 +356,9 @@ void DbObject::VarsChangedHandler(const CustomVarObject::Ptr& object)
|
|||
|
||||
dbobj->SendVarsStatusUpdate();
|
||||
}
|
||||
|
||||
boost::mutex& DbObject::GetStaticMutex(void)
|
||||
{
|
||||
static boost::mutex mutex;
|
||||
return mutex;
|
||||
}
|
||||
|
|
|
@ -105,6 +105,7 @@ private:
|
|||
|
||||
static void StateChangedHandler(const DynamicObject::Ptr& object);
|
||||
static void VarsChangedHandler(const CustomVarObject::Ptr& object);
|
||||
static boost::mutex& GetStaticMutex(void);
|
||||
|
||||
friend class DbType;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue