From 4dabd9c0472deb49573fdafef2fa413e59703f19 Mon Sep 17 00:00:00 2001 From: Steven Bennetts Date: Fri, 2 Mar 2007 21:25:50 +0000 Subject: merge release@58699 beta-1-14-0@58707 -> release --- indra/llcommon/llmemory.h | 51 ++--------------------------------------------- 1 file changed, 2 insertions(+), 49 deletions(-) (limited to 'indra/llcommon/llmemory.h') 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 #include "llerror.h" -#include "llthread.h" -#include "llmemtype.h" extern S32 gTotalDAlloc; extern S32 gTotalDAUse; @@ -42,53 +40,7 @@ private: // LLPointer 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 LLPointer { public: -- cgit v1.2.3