summaryrefslogtreecommitdiff
path: root/indra/llcommon/llthread.cpp
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2023-11-17 14:31:21 -0500
committerNat Goodspeed <nat@lindenlab.com>2023-11-17 14:31:21 -0500
commit5fa7f69101a889009194eeddb927599d7536613f (patch)
treea742817431760d8fc947ad338743978605397f3a /indra/llcommon/llthread.cpp
parente7ae20c96fccdad06e39a3f8e5fe61a812029242 (diff)
SL-20546: Defend llrand's random generator against concurrent access
by making it thread_local.
Diffstat (limited to 'indra/llcommon/llthread.cpp')
-rw-r--r--indra/llcommon/llthread.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/indra/llcommon/llthread.cpp b/indra/llcommon/llthread.cpp
index a807acc56e..a051c7f575 100644
--- a/indra/llcommon/llthread.cpp
+++ b/indra/llcommon/llthread.cpp
@@ -112,15 +112,16 @@ LL_COMMON_API bool on_main_thread()
return (LLThread::currentID() == main_thread());
}
-LL_COMMON_API void assert_main_thread()
+LL_COMMON_API bool assert_main_thread()
{
auto curr = LLThread::currentID();
auto main = main_thread();
- if (curr != main)
- {
- LL_WARNS() << "Illegal execution from thread id " << curr
- << " outside main thread " << main << LL_ENDL;
- }
+ if (curr == main)
+ return true;
+
+ LL_WARNS() << "Illegal execution from thread id " << curr
+ << " outside main thread " << main << LL_ENDL;
+ return false;
}
// this function has become moot