diff options
author | Nat Goodspeed <nat@lindenlab.com> | 2023-11-17 14:31:21 -0500 |
---|---|---|
committer | Nat Goodspeed <nat@lindenlab.com> | 2023-11-17 14:31:21 -0500 |
commit | 5fa7f69101a889009194eeddb927599d7536613f (patch) | |
tree | a742817431760d8fc947ad338743978605397f3a /indra/llcommon/llthread.cpp | |
parent | e7ae20c96fccdad06e39a3f8e5fe61a812029242 (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.cpp | 13 |
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 |