diff options
author | RunitaiLinden <davep@lindenlab.com> | 2024-05-02 10:59:29 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-02 10:59:29 -0500 |
commit | e8219cb0509d5aacc75cf862c6b8cad026590958 (patch) | |
tree | bfd85d36db258f46b74aa9989c1615d9bd7faf72 /indra/llcommon/llmutex.cpp | |
parent | a701cce8e0959503156a010683f6d0d57beaae36 (diff) | |
parent | 7fc5f7e649c564fa8479a72a45459d0cc427d0f8 (diff) |
Merge branch 'project/gltf_development' into 1357-gltf-asset-prototype
Diffstat (limited to 'indra/llcommon/llmutex.cpp')
-rw-r--r-- | indra/llcommon/llmutex.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/indra/llcommon/llmutex.cpp b/indra/llcommon/llmutex.cpp index 0273dd5970..5d93d6e72b 100644 --- a/indra/llcommon/llmutex.cpp +++ b/indra/llcommon/llmutex.cpp @@ -28,6 +28,7 @@ #include "llmutex.h" #include "llthread.h" #include "lltimer.h" +#include "llcoros.h" //============================================================================ @@ -44,7 +45,17 @@ LLMutex::~LLMutex() void LLMutex::lock() { - LL_PROFILE_ZONE_SCOPED_CATEGORY_THREAD + LL_PROFILE_ZONE_SCOPED_CATEGORY_THREAD; + + // LLMutex is not coroutine aware and should not be used from a coroutine + // If your code is running in a coroutine, you should use LLCoros::Mutex instead + // NOTE: If the stack trace you're staring at contains non-thread-safe code, + // you should use LLAppViewer::instance().postToMainThread() to shuttle execution + // back to the main loop. + // NOTE: If you got here from seeing this assert in your log and you're not seeing + // a stack trace that points here, put a breakpoint in on_main_coro and try again. + llassert(LLCoros::on_main_coro()); + if(isSelfLocked()) { //redundant lock mCount++; @@ -66,7 +77,8 @@ void LLMutex::lock() void LLMutex::unlock() { - LL_PROFILE_ZONE_SCOPED_CATEGORY_THREAD + LL_PROFILE_ZONE_SCOPED_CATEGORY_THREAD; + if (mCount > 0) { //not the root unlock mCount--; @@ -111,7 +123,7 @@ LLThread::id_t LLMutex::lockingThread() const bool LLMutex::trylock() { - LL_PROFILE_ZONE_SCOPED_CATEGORY_THREAD + LL_PROFILE_ZONE_SCOPED_CATEGORY_THREAD; if(isSelfLocked()) { //redundant lock mCount++; |