summaryrefslogtreecommitdiff
path: root/indra/newview/lleventpoll.cpp
diff options
context:
space:
mode:
authorcosmic-linden <111533034+cosmic-linden@users.noreply.github.com>2023-12-04 16:44:40 -0800
committerGitHub <noreply@github.com>2023-12-04 16:44:40 -0800
commit1718fe5da2e19ddbe9a738eef273112632e5dd35 (patch)
treecb358e20947f6378a009c97103f878d8a79a3ff1 /indra/newview/lleventpoll.cpp
parent4a8a3100a978989f246b7f837e8a45968908d27b (diff)
parent18f42a659b98741a9d8c05731a8137080c9094b5 (diff)
Merge pull request #556 from secondlife/davep/SL-20611
SL-20611 Make haze effect local lights. Incidental fix for EventPump coroutine sometimes doing unsafe work mid-render.
Diffstat (limited to 'indra/newview/lleventpoll.cpp')
-rw-r--r--indra/newview/lleventpoll.cpp24
1 files changed, 23 insertions, 1 deletions
diff --git a/indra/newview/lleventpoll.cpp b/indra/newview/lleventpoll.cpp
index 26782e53f0..6ffc8f7bdd 100644
--- a/indra/newview/lleventpoll.cpp
+++ b/indra/newview/lleventpoll.cpp
@@ -102,6 +102,7 @@ namespace Details
void LLEventPollImpl::handleMessage(const LLSD& content)
{
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_APP;
std::string msg_name = content["message"];
LLSD message;
message["sender"] = mSenderIp;
@@ -149,6 +150,14 @@ namespace Details
mAdapter = httpAdapter;
+ LL::WorkQueue::ptr_t main_queue = nullptr;
+
+ // HACK -- grab the mainloop workqueue to move execution of the handler
+ // to a place that's safe in the main thread
+#if 1
+ main_queue = LL::WorkQueue::getInstance("mainloop");
+#endif
+
// continually poll for a server update until we've been flagged as
// finished
while (!mDone)
@@ -266,13 +275,26 @@ namespace Details
// was LL_INFOS() but now that CoarseRegionUpdate is TCP @ 1/second, it'd be too verbose for viewer logs. -MG
LL_DEBUGS("LLEventPollImpl") << " <" << counter << "> " << events.size() << "events (id " << acknowledge << ")" << LL_ENDL;
+
LLSD::array_const_iterator i = events.beginArray();
LLSD::array_const_iterator end = events.endArray();
for (; i != end; ++i)
{
if (i->has("message"))
{
- handleMessage(*i);
+ if (main_queue)
+ { // shuttle to a sensible spot in the main thread instead
+ // of wherever this coroutine happens to be executing
+ const LLSD& msg = *i;
+ main_queue->post([this, msg]()
+ {
+ handleMessage(msg);
+ });
+ }
+ else
+ {
+ handleMessage(*i);
+ }
}
}
}