summaryrefslogtreecommitdiff
path: root/indra/llcommon/llrefcount.h
diff options
context:
space:
mode:
authorXiaohong Bao <bao@lindenlab.com>2011-01-04 16:50:42 -0700
committerXiaohong Bao <bao@lindenlab.com>2011-01-04 16:50:42 -0700
commit4a29253a59140727334084768ebc7850d3d94eed (patch)
tree9b177328f8db531db478109e02a11e4b3f5888e2 /indra/llcommon/llrefcount.h
parent8eda31456a0466cfa7674a881ebc69ea2abbf8a1 (diff)
parentf1b7fce1db6cd7a8f312216baaa8fada931b2579 (diff)
Automated merge with http://hg.secondlife.com/mesh-development
Diffstat (limited to 'indra/llcommon/llrefcount.h')
-rw-r--r--indra/llcommon/llrefcount.h20
1 files changed, 18 insertions, 2 deletions
diff --git a/indra/llcommon/llrefcount.h b/indra/llcommon/llrefcount.h
index 19f008b15c..693c1c4b83 100644
--- a/indra/llcommon/llrefcount.h
+++ b/indra/llcommon/llrefcount.h
@@ -28,6 +28,11 @@
#include <boost/noncopyable.hpp>
+#define LL_REF_COUNT_DEBUG 0
+#if LL_REF_COUNT_DEBUG
+class LLMutex ;
+#endif
+
//----------------------------------------------------------------------------
// RefCount objects should generally only be accessed by way of LLPointer<>'s
// see llthread.h for LLThreadSafeRefCount
@@ -43,12 +48,16 @@ protected:
public:
LLRefCount();
- void ref() const
+#if LL_REF_COUNT_DEBUG
+ void ref() const ;
+ S32 unref() const ;
+#else
+ inline void LLRefCount::ref() const
{
mRef++;
}
- S32 unref() const
+ inline S32 LLRefCount::unref() const
{
llassert(mRef >= 1);
if (0 == --mRef)
@@ -58,6 +67,7 @@ public:
}
return mRef;
}
+#endif
//NOTE: when passing around a const LLRefCount object, this can return different results
// at different types, since mRef is mutable
@@ -68,6 +78,12 @@ public:
private:
mutable S32 mRef;
+
+#if LL_REF_COUNT_DEBUG
+ LLMutex* mMutexp ;
+ mutable U32 mLockedThreadID ;
+ mutable BOOL mCrashAtUnlock ;
+#endif
};
#endif