diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2021-05-21 19:06:11 +0300 |
---|---|---|
committer | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2021-05-24 15:59:52 +0300 |
commit | fa26f5eaa2cb1a0152fe681e9baa292626564caf (patch) | |
tree | b0fafcfce057a5d8c316890e923d829c07b7e948 | |
parent | cb8b5f6ba61b6fd11aae92ca9cb5fdee5032a877 (diff) |
SL-14988 Viewer freezes when opening any CEF based window
Don't block main thread if possible
-rw-r--r-- | indra/llplugin/llpluginprocessparent.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/indra/llplugin/llpluginprocessparent.cpp b/indra/llplugin/llpluginprocessparent.cpp index 7d18bae947..f4bd944387 100644 --- a/indra/llplugin/llpluginprocessparent.cpp +++ b/indra/llplugin/llpluginprocessparent.cpp @@ -320,8 +320,9 @@ void LLPluginProcessParent::idle(void) do { // process queued messages - mIncomingQueueMutex.lock(); - while(!mIncomingQueue.empty()) + // Inside main thread, it is preferable not to block it on mutex. + bool locked = mIncomingQueueMutex.trylock(); + while(locked && !mIncomingQueue.empty()) { LLPluginMessage message = mIncomingQueue.front(); mIncomingQueue.pop(); @@ -329,10 +330,13 @@ void LLPluginProcessParent::idle(void) receiveMessage(message); - mIncomingQueueMutex.lock(); + locked = mIncomingQueueMutex.trylock(); } - mIncomingQueueMutex.unlock(); + if (locked) + { + mIncomingQueueMutex.unlock(); + } // Give time to network processing if(mMessagePipe) |