summaryrefslogtreecommitdiff
path: root/indra/llcommon
diff options
context:
space:
mode:
authorsimon <none@none>2013-04-17 11:17:46 -0700
committersimon <none@none>2013-04-17 11:17:46 -0700
commit6742d90d39fbb5c5bc3b675f37841fd6c8ec09c9 (patch)
tree841285193b28a3c971051f53573a2a2f1c83a330 /indra/llcommon
parentc537b63936e49d4e685d96695334fdd7a961b470 (diff)
Some minor cleanups while hunting crashes. Reviewed by Kelly
Diffstat (limited to 'indra/llcommon')
-rw-r--r--indra/llcommon/llcommon.cpp1
-rw-r--r--indra/llcommon/llinstancetracker.h8
-rw-r--r--indra/llcommon/llthread.cpp3
-rw-r--r--indra/llcommon/llthread.h2
4 files changed, 12 insertions, 2 deletions
diff --git a/indra/llcommon/llcommon.cpp b/indra/llcommon/llcommon.cpp
index 8be9e4f4de..b938b0e65a 100644
--- a/indra/llcommon/llcommon.cpp
+++ b/indra/llcommon/llcommon.cpp
@@ -44,6 +44,7 @@ void LLCommon::initClass()
}
LLTimer::initClass();
LLThreadSafeRefCount::initThreadSafeRefCount();
+ assert_main_thread(); // Make sure we record the main thread
// LLWorkerThread::initClass();
// LLFrameCallbackManager::initClass();
}
diff --git a/indra/llcommon/llinstancetracker.h b/indra/llcommon/llinstancetracker.h
index 0f952f56ac..b290526754 100644
--- a/indra/llcommon/llinstancetracker.h
+++ b/indra/llcommon/llinstancetracker.h
@@ -102,6 +102,8 @@ protected:
};
};
+LL_COMMON_API void assert_main_thread();
+
/// This mix-in class adds support for tracking all instances of the specified class parameter T
/// The (optional) key associates a value of type KEY with a given instance of T, for quick lookup
/// If KEY is not provided, then instances are stored in a simple set
@@ -116,7 +118,11 @@ class LLInstanceTracker : public LLInstanceTrackerBase
InstanceMap sMap;
};
static StaticData& getStatic() { return LLInstanceTrackerBase::getStatic<StaticData, MyT, T, TRACKED>(); }
- static InstanceMap& getMap_() { return getStatic().sMap; }
+ static InstanceMap& getMap_()
+ {
+ // assert_main_thread(); fwiw this class is not thread safe, and it used by multiple threads. Bad things happen.
+ return getStatic().sMap;
+ }
public:
class instance_iter : public boost::iterator_facade<instance_iter, T, boost::forward_traversal_tag>
diff --git a/indra/llcommon/llthread.cpp b/indra/llcommon/llthread.cpp
index 6c117f7daf..60adeeaeb7 100644
--- a/indra/llcommon/llthread.cpp
+++ b/indra/llcommon/llthread.cpp
@@ -67,7 +67,8 @@ LL_COMMON_API void assert_main_thread()
static U32 s_thread_id = LLThread::currentID();
if (LLThread::currentID() != s_thread_id)
{
- llerrs << "Illegal execution outside main thread." << llendl;
+ llwarns << "Illegal execution from thread id " << (S32) LLThread::currentID()
+ << " outside main thread " << (S32) s_thread_id << llendl;
}
}
diff --git a/indra/llcommon/llthread.h b/indra/llcommon/llthread.h
index 8c95b1c0e5..11594f276e 100644
--- a/indra/llcommon/llthread.h
+++ b/indra/llcommon/llthread.h
@@ -311,4 +311,6 @@ public:
//============================================================================
+extern LL_COMMON_API void assert_main_thread();
+
#endif // LL_LLTHREAD_H