summaryrefslogtreecommitdiff
path: root/indra/llcommon
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llcommon')
-rw-r--r--indra/llcommon/llfasttimer_class.h8
-rw-r--r--indra/llcommon/llthread.cpp9
2 files changed, 17 insertions, 0 deletions
diff --git a/indra/llcommon/llfasttimer_class.h b/indra/llcommon/llfasttimer_class.h
index ddb1a74793..d348888832 100644
--- a/indra/llcommon/llfasttimer_class.h
+++ b/indra/llcommon/llfasttimer_class.h
@@ -37,12 +37,17 @@
#define FAST_TIMER_ON 1
#define TIME_FAST_TIMERS 0
+#define DEBUG_FAST_TIMER_THREADS 1
class LLMutex;
#include <queue>
#include "llsd.h"
+#if DEBUG_FAST_TIMER_THREADS
+void assert_main_thread();
+#endif
+
class LL_COMMON_API LLFastTimer
{
public:
@@ -182,6 +187,9 @@ public:
U64 timer_end = getCPUClockCount64();
sTimerCycles += timer_end - timer_start;
#endif
+#if DEBUG_FAST_TIMER_THREADS
+ assert_main_thread();
+#endif
}
LL_FORCE_INLINE ~LLFastTimer()
diff --git a/indra/llcommon/llthread.cpp b/indra/llcommon/llthread.cpp
index 0385569a02..10cc409c6e 100644
--- a/indra/llcommon/llthread.cpp
+++ b/indra/llcommon/llthread.cpp
@@ -68,6 +68,15 @@ U32 ll_thread_local sThreadID = 0;
U32 LLThread::sIDIter = 0;
+void assert_main_thread()
+{
+ static U32 s_thread_id = LLThread::currentID();
+ if (LLThread::currentID() != s_thread_id)
+ {
+ llerrs << "Illegal execution outside main thread." << llendl;
+ }
+}
+
//
// Handed to the APR thread creation function
//