summaryrefslogtreecommitdiff
path: root/indra/llcommon/llrefcount.h
diff options
context:
space:
mode:
authorLoren Shih <seraph@lindenlab.com>2011-01-05 15:10:31 -0500
committerLoren Shih <seraph@lindenlab.com>2011-01-05 15:10:31 -0500
commitdf1c6d2a2e4ccfe7bd19a66ba95c4f7bc6edee5e (patch)
tree5d278369af1ba0ee4e75868b676b486009dbace2 /indra/llcommon/llrefcount.h
parent02783213455418a509994df16f9250b05753c183 (diff)
parentdfddccd65da32ac2c11c9106c3995a3281d7c30d (diff)
Automated merge from 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..868789de4d 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
+ void LLRefCount::ref() const
{
mRef++;
}
- S32 unref() const
+ 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