Skip to content
Snippets Groups Projects
Commit a886217b authored by Rye Mutt's avatar Rye Mutt :bread:
Browse files

Better incoming message polling for plugin process

parent ea2c1c88
No related branches found
No related tags found
No related merge requests found
......@@ -315,19 +315,24 @@ void LLPluginProcessParent::idle(void)
do
{
// process queued messages
mIncomingQueueMutex.lock();
while(!mIncomingQueue.empty())
if (!mIncomingQueue.empty())
{
LLPluginMessage message = mIncomingQueue.front();
mIncomingQueue.pop();
mIncomingQueueMutex.unlock();
receiveMessage(message);
mIncomingQueueMutex.lock();
}
LLMutexTrylock locked_mtx(&mIncomingQueueMutex);
if (locked_mtx.isLocked())
{
if (!mIncomingQueue.empty())
{
std::deque<LLPluginMessage> local_queue;
local_queue.swap(mIncomingQueue);
for(const auto& message : local_queue)
{
receiveMessage(message);
}
}
}
mIncomingQueueMutex.unlock();
}
// Give time to network processing
if(mMessagePipe)
......@@ -870,10 +875,9 @@ void LLPluginProcessParent::poll(F64 timeout)
if (that)
{
that->mIncomingQueueMutex.lock();
LLMutexLock incoming_lock(&that->mIncomingQueueMutex);
that->servicePoll();
that->mIncomingQueueMutex.unlock();
}
}
}
}
......@@ -978,7 +982,7 @@ void LLPluginProcessParent::receiveMessageEarly(const LLPluginMessage &message)
if(!handled)
{
// any message that wasn't handled early needs to be queued.
mIncomingQueue.push(message);
mIncomingQueue.push_back(message);
}
}
......
......@@ -210,7 +210,7 @@ class LLPluginProcessParent : public LLPluginMessagePipeOwner
bool pollTick();
LLMutex mIncomingQueueMutex;
std::queue<LLPluginMessage> mIncomingQueue;
std::deque<LLPluginMessage> mIncomingQueue;
};
#endif // LL_LLPLUGINPROCESSPARENT_H
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment