summaryrefslogtreecommitdiff
path: root/indra/llcommon
diff options
context:
space:
mode:
authorXiaohong Bao <bao@lindenlab.com>2012-01-20 11:55:15 -0700
committerXiaohong Bao <bao@lindenlab.com>2012-01-20 11:55:15 -0700
commit9e6a5d721193f181c39e58fe00073bece74b081a (patch)
treebcc8aa49ccf5e8b0ce528a888a46efaabf4d263b /indra/llcommon
parent25c21c3761d871fa7927e2a5656ed18100084454 (diff)
fix for SH-2823 and SH-2824: LLCurl crash inside LLBufferArray::countAfter() and LLBufferArray::copyIntoBuffers
Diffstat (limited to 'indra/llcommon')
-rw-r--r--indra/llcommon/llthread.cpp15
-rw-r--r--indra/llcommon/llthread.h1
2 files changed, 11 insertions, 5 deletions
diff --git a/indra/llcommon/llthread.cpp b/indra/llcommon/llthread.cpp
index 4063cc730b..a6ad6b125c 100644
--- a/indra/llcommon/llthread.cpp
+++ b/indra/llcommon/llthread.cpp
@@ -337,11 +337,7 @@ LLMutex::~LLMutex()
void LLMutex::lock()
{
-#if LL_DARWIN
- if (mLockingThread == LLThread::currentID())
-#else
- if (mLockingThread == sThreadID)
-#endif
+ if(isSelfLocked())
{ //redundant lock
mCount++;
return;
@@ -398,6 +394,15 @@ bool LLMutex::isLocked()
}
}
+bool LLMutex::isSelfLocked()
+{
+#if LL_DARWIN
+ return mLockingThread == LLThread::currentID();
+#else
+ return mLockingThread == sThreadID;
+#endif
+}
+
U32 LLMutex::lockingThread() const
{
return mLockingThread;
diff --git a/indra/llcommon/llthread.h b/indra/llcommon/llthread.h
index f0e0de6173..b52e70ab2e 100644
--- a/indra/llcommon/llthread.h
+++ b/indra/llcommon/llthread.h
@@ -151,6 +151,7 @@ public:
void lock(); // blocks
void unlock();
bool isLocked(); // non-blocking, but does do a lock/unlock so not free
+ bool isSelfLocked(); //return true if locked in a same thread
U32 lockingThread() const; //get ID of locking thread
protected: