summaryrefslogtreecommitdiff
path: root/indra/llcommon/llmemory.h
diff options
context:
space:
mode:
authorSteven Bennetts <steve@lindenlab.com>2007-03-02 21:25:50 +0000
committerSteven Bennetts <steve@lindenlab.com>2007-03-02 21:25:50 +0000
commit4dabd9c0472deb49573fdafef2fa413e59703f19 (patch)
tree06c680d6a2047e03838d6548bccd26c7baf9d652 /indra/llcommon/llmemory.h
parentd4462963c6ba5db2088723bbedc7b60f1184c594 (diff)
merge release@58699 beta-1-14-0@58707 -> release
Diffstat (limited to 'indra/llcommon/llmemory.h')
-rw-r--r--indra/llcommon/llmemory.h51
1 files changed, 2 insertions, 49 deletions
diff --git a/indra/llcommon/llmemory.h b/indra/llcommon/llmemory.h
index 962a4aa5d5..d543d023ff 100644
--- a/indra/llcommon/llmemory.h
+++ b/indra/llcommon/llmemory.h
@@ -12,8 +12,6 @@
#include <cstdlib>
#include "llerror.h"
-#include "llthread.h"
-#include "llmemtype.h"
extern S32 gTotalDAlloc;
extern S32 gTotalDAUse;
@@ -42,53 +40,7 @@ private:
// LLPointer<LLFoo> x = new LLFoo; // constructor does not do anything interesting
// x->instantiate(); // does stuff like place x into an update queue
-class LLThreadSafeRefCount
-{
-public:
- static void initClass(); // creates sMutex
- static void cleanupClass(); // destroys sMutex
-
-private:
- static LLMutex* sMutex;
-
-private:
- LLThreadSafeRefCount(const LLThreadSafeRefCount&); // not implemented
- LLThreadSafeRefCount&operator=(const LLThreadSafeRefCount&); // not implemented
-
-protected:
- virtual ~LLThreadSafeRefCount(); // use unref()
-
-public:
- LLThreadSafeRefCount();
-
- void ref()
- {
- if (sMutex) sMutex->lock();
- mRef++;
- if (sMutex) sMutex->unlock();
- }
-
- S32 unref()
- {
- llassert(mRef >= 1);
- if (sMutex) sMutex->lock();
- S32 res = --mRef;
- if (sMutex) sMutex->unlock();
- if (0 == res)
- {
- delete this;
- res = 0;
- }
- return res;
- }
- S32 getNumRefs() const
- {
- return mRef;
- }
-
-private:
- S32 mRef;
-};
+// see llthread.h for LLThreadSafeRefCount
//----------------------------------------------------------------------------
@@ -132,6 +84,7 @@ private:
//----------------------------------------------------------------------------
+// Note: relies on Type having ref() and unref() methods
template <class Type> class LLPointer
{
public: