diff options
Diffstat (limited to 'indra/llcommon')
-rw-r--r-- | indra/llcommon/llapp.cpp | 1 | ||||
-rw-r--r-- | indra/llcommon/lualistener.cpp | 8 | ||||
-rw-r--r-- | indra/llcommon/lualistener.h | 2 |
3 files changed, 8 insertions, 3 deletions
diff --git a/indra/llcommon/llapp.cpp b/indra/llcommon/llapp.cpp index b99166991f..905db9e491 100644 --- a/indra/llcommon/llapp.cpp +++ b/indra/llcommon/llapp.cpp @@ -429,6 +429,7 @@ void LLApp::setStatus(EAppStatus status) statsd = LLSD::Integer(status); } LLEventPumps::instance().obtain("LLApp").post(llsd::map("status", statsd)); + LLEventPumps::instance().obtain("LLLua").post(llsd::map("status", "close_all")); } } diff --git a/indra/llcommon/lualistener.cpp b/indra/llcommon/lualistener.cpp index 82e32860db..d4bd73a9fb 100644 --- a/indra/llcommon/lualistener.cpp +++ b/indra/llcommon/lualistener.cpp @@ -33,18 +33,20 @@ std::ostream& operator<<(std::ostream& out, const LuaListener& self) LuaListener::LuaListener(lua_State* L): super(getUniqueKey()), + mCoroName(LLCoros::getName()), mListener(new LLLeapListener( "LuaListener", [this](const std::string& pump, const LLSD& data) { return queueEvent(pump, data); })), // Listen for shutdown events on the "LLApp" LLEventPump. mShutdownConnection( - LLEventPumps::instance().obtain("LLApp").listen( + LLEventPumps::instance().obtain("LLLua").listen( LLEventPump::inventName("LuaState"), [this](const LLSD& status) { - const auto& statsd = status["status"]; - if (statsd.asString() != "running") + auto coro_name = status["coro"].asString(); + auto statsd = status["status"].asString(); + if ((statsd == "close_all") || ((statsd == "close") && (coro_name == mCoroName))) { // If a Lua script is still blocked in getNext() during // viewer shutdown, close the queue to wake up getNext(). diff --git a/indra/llcommon/lualistener.h b/indra/llcommon/lualistener.h index 40ccfba8fe..d349ee23fd 100644 --- a/indra/llcommon/lualistener.h +++ b/indra/llcommon/lualistener.h @@ -75,6 +75,8 @@ private: std::unique_ptr<LLLeapListener> mListener; LLTempBoundListener mShutdownConnection; + + std::string mCoroName; }; #endif /* ! defined(LL_LUALISTENER_H) */ |