diff options
| author | andreykproductengine <andreykproductengine@lindenlab.com> | 2019-01-17 01:53:27 +0200 | 
|---|---|---|
| committer | andreykproductengine <andreykproductengine@lindenlab.com> | 2019-01-17 01:53:27 +0200 | 
| commit | 346fc435f1b12e47b8bf51d15c70ceca4615de41 (patch) | |
| tree | 223dba7ea789e4d484b0abb5206399da2d9f5e24 /indra/llcommon | |
| parent | 26fae750ba753f32f58bd56d297f2d98c5759e50 (diff) | |
SL-10291 cleanup-mutex
Diffstat (limited to 'indra/llcommon')
| -rw-r--r-- | indra/llcommon/llrefcount.cpp | 109 | ||||
| -rw-r--r-- | indra/llcommon/llrefcount.h | 18 | 
2 files changed, 1 insertions, 126 deletions
| diff --git a/indra/llcommon/llrefcount.cpp b/indra/llcommon/llrefcount.cpp index a638df2c7c..29a5ca6f24 100644 --- a/indra/llcommon/llrefcount.cpp +++ b/indra/llcommon/llrefcount.cpp @@ -29,25 +29,9 @@  #include "llerror.h" -#if LL_REF_COUNT_DEBUG -#include "llthread.h" -#include "llapr.h" -#endif -  LLRefCount::LLRefCount(const LLRefCount& other)  :	mRef(0)  { -#if LL_REF_COUNT_DEBUG -	if(gAPRPoolp) -	{ -		mMutexp = new LLMutex(gAPRPoolp) ; -	} -	else -	{ -		mMutexp = NULL ; -	} -	mCrashAtUnlock = FALSE ; -#endif  }  LLRefCount& LLRefCount::operator=(const LLRefCount&) @@ -59,17 +43,6 @@ LLRefCount& LLRefCount::operator=(const LLRefCount&)  LLRefCount::LLRefCount() :  	mRef(0)  { -#if LL_REF_COUNT_DEBUG -	if(gAPRPoolp) -	{ -		mMutexp = new LLMutex(gAPRPoolp) ; -	} -	else -	{ -		mMutexp = NULL ; -	} -	mCrashAtUnlock = FALSE ; -#endif  }  LLRefCount::~LLRefCount() @@ -78,87 +51,5 @@ LLRefCount::~LLRefCount()  	{  		LL_ERRS() << "deleting non-zero reference" << LL_ENDL;  	} - -#if LL_REF_COUNT_DEBUG -	if(gAPRPoolp) -	{ -		delete mMutexp ; -	} -#endif  } -#if LL_REF_COUNT_DEBUG -void LLRefCount::ref() const -{  -	if(mMutexp) -	{ -		if(mMutexp->isLocked())  -		{ -			mCrashAtUnlock = TRUE ; -			LL_ERRS() << "the mutex is locked by the thread: " << mLockedThreadID  -				<< " Current thread: " << LLThread::currentID() << LL_ENDL ; -		} - -		mMutexp->lock() ; -		mLockedThreadID = LLThread::currentID() ; - -		mRef++;  - -		if(mCrashAtUnlock) -		{ -			while(1); //crash here. -		} -		mMutexp->unlock() ; -	} -	else -	{ -		mRef++;  -	} -}  - -S32 LLRefCount::unref() const -{ -	if(mMutexp) -	{ -		if(mMutexp->isLocked())  -		{ -			mCrashAtUnlock = TRUE ; -			LL_ERRS() << "the mutex is locked by the thread: " << mLockedThreadID  -				<< " Current thread: " << LLThread::currentID() << LL_ENDL ; -		} - -		mMutexp->lock() ; -		mLockedThreadID = LLThread::currentID() ; -		 -		llassert(mRef >= 1); -		if (0 == --mRef)  -		{ -			if(mCrashAtUnlock) -			{ -				while(1); //crash here. -			} -			mMutexp->unlock() ; - -			delete this;  -			return 0; -		} - -		if(mCrashAtUnlock) -		{ -			while(1); //crash here. -		} -		mMutexp->unlock() ; -		return mRef; -	} -	else -	{ -		llassert(mRef >= 1); -		if (0 == --mRef)  -		{ -			delete this;  -			return 0; -		} -		return mRef; -	} -}	 -#endif diff --git a/indra/llcommon/llrefcount.h b/indra/llcommon/llrefcount.h index 1107973569..cdc60fa54f 100644 --- a/indra/llcommon/llrefcount.h +++ b/indra/llcommon/llrefcount.h @@ -31,11 +31,6 @@  #include "llmutex.h"  #include "llapr.h" -#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 @@ -51,10 +46,6 @@ protected:  public:  	LLRefCount(); -#if LL_REF_COUNT_DEBUG -	void ref() const ; -	S32 unref() const ; -#else  	inline void ref() const  	{   		mRef++;  @@ -69,8 +60,7 @@ public:  			return 0;  		}  		return mRef; -	}	 -#endif +	}  	//NOTE: when passing around a const LLRefCount object, this can return different results  	// at different types, since mRef is mutable @@ -81,12 +71,6 @@ public:  private:   	mutable S32	mRef;  - -#if LL_REF_COUNT_DEBUG -	LLMutex*  mMutexp ; -	mutable U32  mLockedThreadID ; -	mutable BOOL mCrashAtUnlock ;  -#endif  }; | 
