summaryrefslogtreecommitdiff
path: root/indra/llcommon/llthread.cpp
diff options
context:
space:
mode:
authorLoren Shih <seraph@lindenlab.com>2009-11-24 12:10:10 -0500
committerLoren Shih <seraph@lindenlab.com>2009-11-24 12:10:10 -0500
commita22bb00530bb779d8e5bb40b68e55767604d88dc (patch)
tree520019b0c1e8c9cf475d19a60a0322a3c1caea6e /indra/llcommon/llthread.cpp
parent0904cbe4846192c9897267c9a60175f84881f9ed (diff)
parent76be5ddc7022508e7d3fcb04165b4a6f64f1d58d (diff)
merge
--HG-- branch : avatar-pipeline
Diffstat (limited to 'indra/llcommon/llthread.cpp')
-rw-r--r--indra/llcommon/llthread.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/indra/llcommon/llthread.cpp b/indra/llcommon/llthread.cpp
index 920d8c0977..37370e44e7 100644
--- a/indra/llcommon/llthread.cpp
+++ b/indra/llcommon/llthread.cpp
@@ -291,8 +291,8 @@ LLMutex::LLMutex(apr_pool_t *poolp) :
LLMutex::~LLMutex()
{
-#if _DEBUG
- llassert(!isLocked()); // better not be locked!
+#if MUTEX_DEBUG
+ llassert_always(!isLocked()); // better not be locked!
#endif
apr_thread_mutex_destroy(mAPRMutexp);
mAPRMutexp = NULL;
@@ -306,10 +306,24 @@ LLMutex::~LLMutex()
void LLMutex::lock()
{
apr_thread_mutex_lock(mAPRMutexp);
+#if MUTEX_DEBUG
+ // Have to have the lock before we can access the debug info
+ U32 id = LLThread::currentID();
+ if (mIsLocked[id] != FALSE)
+ llerrs << "Already locked in Thread: " << id << llendl;
+ mIsLocked[id] = TRUE;
+#endif
}
void LLMutex::unlock()
{
+#if MUTEX_DEBUG
+ // Access the debug info while we have the lock
+ U32 id = LLThread::currentID();
+ if (mIsLocked[id] != TRUE)
+ llerrs << "Not locked in Thread: " << id << llendl;
+ mIsLocked[id] = FALSE;
+#endif
apr_thread_mutex_unlock(mAPRMutexp);
}