mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-27 07:34:15 +02:00
parent
e4b7111577
commit
db0c6ef187
@ -30,11 +30,11 @@ using namespace icinga;
|
|||||||
|
|
||||||
DEFINE_TYPE_INSTANCE(Object);
|
DEFINE_TYPE_INSTANCE(Object);
|
||||||
|
|
||||||
#ifdef I2_DEBUG
|
#ifdef I2_LEAK_DEBUG
|
||||||
static boost::mutex l_ObjectCountLock;
|
static boost::mutex l_ObjectCountLock;
|
||||||
static std::map<String, int> l_ObjectCounts;
|
static std::map<String, int> l_ObjectCounts;
|
||||||
static Timer::Ptr l_ObjectCountTimer;
|
static Timer::Ptr l_ObjectCountTimer;
|
||||||
#endif
|
#endif /* I2_LEAK_DEBUG */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default constructor for the Object class.
|
* Default constructor for the Object class.
|
||||||
@ -128,7 +128,7 @@ Type::Ptr Object::GetReflectionType(void) const
|
|||||||
return Object::TypeInstance;
|
return Object::TypeInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef I2_DEBUG
|
#ifdef I2_LEAK_DEBUG
|
||||||
void icinga::TypeAddObject(Object *object)
|
void icinga::TypeAddObject(Object *object)
|
||||||
{
|
{
|
||||||
boost::mutex::scoped_lock lock(l_ObjectCountLock);
|
boost::mutex::scoped_lock lock(l_ObjectCountLock);
|
||||||
@ -168,5 +168,5 @@ static void StartTypeInfoTimer(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
INITIALIZE_ONCE(StartTypeInfoTimer);
|
INITIALIZE_ONCE(StartTypeInfoTimer);
|
||||||
#endif /* I2_DEBUG */
|
#endif /* I2_LEAK_DEBUG */
|
||||||
|
|
||||||
|
@ -139,10 +139,10 @@ void TypeRemoveObject(Object *object);
|
|||||||
|
|
||||||
inline void intrusive_ptr_add_ref(Object *object)
|
inline void intrusive_ptr_add_ref(Object *object)
|
||||||
{
|
{
|
||||||
#ifdef I2_DEBUG
|
#ifdef I2_LEAK_DEBUG
|
||||||
if (object->m_References == 0)
|
if (object->m_References == 0)
|
||||||
TypeAddObject(object);
|
TypeAddObject(object);
|
||||||
#endif /* I2_DEBUG */
|
#endif /* I2_LEAK_DEBUG */
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
InterlockedIncrement(&object->m_References);
|
InterlockedIncrement(&object->m_References);
|
||||||
@ -163,9 +163,9 @@ inline void intrusive_ptr_release(Object *object)
|
|||||||
ASSERT(refs >= 0);
|
ASSERT(refs >= 0);
|
||||||
|
|
||||||
if (refs == 0) {
|
if (refs == 0) {
|
||||||
#ifdef I2_DEBUG
|
#ifdef I2_LEAK_DEBUG
|
||||||
TypeRemoveObject(object);
|
TypeRemoveObject(object);
|
||||||
#endif /* I2_DEBUG */
|
#endif /* I2_LEAK_DEBUG */
|
||||||
|
|
||||||
delete object;
|
delete object;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user