summaryrefslogtreecommitdiff
path: root/indra/llmessage
diff options
context:
space:
mode:
authorRunitaiLinden <davep@lindenlab.com>2024-05-02 10:57:39 -0500
committerGitHub <noreply@github.com>2024-05-02 10:57:39 -0500
commit7fc5f7e649c564fa8479a72a45459d0cc427d0f8 (patch)
tree172449a55f78177fd1ea4c6ed1586b66141fdb33 /indra/llmessage
parent9b6979f458b585618fa59887b500a1a7a4a6e02f (diff)
#1354 Make coroutines use LLCoros::Mutex instead of LLMutex (#1356)
* #1354 Make coroutines use LLCoros::Mutex instead of LLMutex * #1354 Fix some more unsafe coroutine executions. * #1354 Implement changes requested by Nat
Diffstat (limited to 'indra/llmessage')
-rw-r--r--indra/llmessage/llavatarnamecache.cpp32
1 files changed, 20 insertions, 12 deletions
diff --git a/indra/llmessage/llavatarnamecache.cpp b/indra/llmessage/llavatarnamecache.cpp
index f7a9f55685..314e7f0217 100644
--- a/indra/llmessage/llavatarnamecache.cpp
+++ b/indra/llmessage/llavatarnamecache.cpp
@@ -45,6 +45,7 @@
#include "llcorehttputil.h"
#include "llexception.h"
#include "stringize.h"
+#include "workqueue.h"
#include <map>
#include <set>
@@ -179,19 +180,26 @@ void LLAvatarNameCache::requestAvatarNameCache_(std::string url, std::vector<LLU
if (LLAvatarNameCache::instanceExists())
{
- if (!success)
- { // on any sort of failure add dummy records for any agent IDs
- // in this request that we do not have cached already
- std::vector<LLUUID>::const_iterator it = agentIds.begin();
- for (; it != agentIds.end(); ++it)
- {
- const LLUUID& agent_id = *it;
- LLAvatarNameCache::getInstance()->handleAgentError(agent_id);
- }
- return;
- }
+ // dispatch handler execution back to mainloop
+ auto workqueue = LL::WorkQueue::getInstance("mainloop");
- LLAvatarNameCache::getInstance()->handleAvNameCacheSuccess(results, httpResults);
+ if (workqueue)
+ {
+ workqueue->post([=]()
+ {
+ if (!success)
+ { // on any sort of failure add dummy records for any agent IDs
+ // in this request that we do not have cached already
+ for (const auto& agent_id : agentIds)
+ {
+ LLAvatarNameCache::getInstance()->handleAgentError(agent_id);
+ }
+ return;
+ }
+
+ LLAvatarNameCache::getInstance()->handleAvNameCacheSuccess(results, httpResults);
+ });
+ }
}
}
catch (const LLCoros::Stop&)