Skip to content
Snippets Groups Projects
Commit 26c8ccfc authored by Nat Goodspeed's avatar Nat Goodspeed
Browse files

DRTVWR-476: Back out changeset 40c0c6a8407d ("final" LLApp listener)

parent cbf146f2
No related branches found
No related tags found
No related merge requests found
...@@ -128,38 +128,6 @@ LLCoros::LLCoros(): ...@@ -128,38 +128,6 @@ LLCoros::LLCoros():
mStackSize(256*1024) mStackSize(256*1024)
#endif #endif
{ {
// Set up a listener to notice when the viewer is starting to shut down.
// Store the connection in an LLTempBoundListener so it will automatically
// disconnect.
mAppListener = LLEventPumps::instance().obtain("LLApp").listen(
"final", // must be the LAST listener on this LLEventPump
[this](const LLSD& status)
{
if (status["status"].asString() == "quitting")
{
// Other LLApp status-change listeners do things like close
// work queues and inject the Stop exception into pending
// promises, to force coroutines waiting on those things to
// notice and terminate. The only problem is that by the time
// LLApp sets "quitting" status, the main loop has stopped
// pumping the fiber scheduler with yield() calls. A waiting
// coroutine still might not wake up until after resources on
// which it depends have been freed. Pump it a few times
// ourselves. Of course, stop pumping as soon as the last of
// the coroutines has terminated.
for (size_t count = 0; count < 10 && ! mCoros.empty(); ++count)
{
// don't use llcoro::suspend() because that module depends
// on this one
boost::this_fiber::yield();
}
}
// If we're really the last listener, it shouldn't matter whether
// we consume this event -- but our being last depends on every
// other listen() call specifying before "final", which would be
// all too easy to forget. So do not consume the event.
return false;
});
} }
LLCoros::~LLCoros() LLCoros::~LLCoros()
......
...@@ -34,7 +34,6 @@ ...@@ -34,7 +34,6 @@
#include <boost/fiber/future/promise.hpp> #include <boost/fiber/future/promise.hpp>
#include <boost/fiber/future/future.hpp> #include <boost/fiber/future/future.hpp>
#include "llsingleton.h" #include "llsingleton.h"
#include "llevents.h"
#include <boost/ptr_container/ptr_map.hpp> #include <boost/ptr_container/ptr_map.hpp>
#include <boost/function.hpp> #include <boost/function.hpp>
#include <string> #include <string>
...@@ -285,8 +284,6 @@ class LL_COMMON_API LLCoros: public LLSingleton<LLCoros> ...@@ -285,8 +284,6 @@ class LL_COMMON_API LLCoros: public LLSingleton<LLCoros>
typedef boost::ptr_map<std::string, CoroData> CoroMap; typedef boost::ptr_map<std::string, CoroData> CoroMap;
CoroMap mCoros; CoroMap mCoros;
LLTempBoundListener mAppListener;
// Identify the current coroutine's CoroData. This local_ptr isn't static // Identify the current coroutine's CoroData. This local_ptr isn't static
// because it's a member of an LLSingleton, and we rely on it being // because it's a member of an LLSingleton, and we rely on it being
// cleaned up in proper dependency order. // cleaned up in proper dependency order.
......
...@@ -153,7 +153,6 @@ postAndSuspendSetup(const std::string& callerName, ...@@ -153,7 +153,6 @@ postAndSuspendSetup(const std::string& callerName,
// The relative order of the two listen() calls below would only matter if // The relative order of the two listen() calls below would only matter if
// "LLApp" were an LLEventMailDrop. But if we ever go there, we'd want to // "LLApp" were an LLEventMailDrop. But if we ever go there, we'd want to
// notice the pending LLApp status first. // notice the pending LLApp status first.
// Run this listener before the "final" listener.
LLBoundListener stopper( LLBoundListener stopper(
LLEventPumps::instance().obtain("LLApp").listen( LLEventPumps::instance().obtain("LLApp").listen(
listenerName, listenerName,
...@@ -182,9 +181,7 @@ postAndSuspendSetup(const std::string& callerName, ...@@ -182,9 +181,7 @@ postAndSuspendSetup(const std::string& callerName,
} }
// do not consume -- every listener must see status // do not consume -- every listener must see status
return false; return false;
}, }));
LLEventPump::NameList{}, // after
LLEventPump::NameList{ "final "})); // before
LLBoundListener connection( LLBoundListener connection(
replyPump.listen( replyPump.listen(
listenerName, listenerName,
......
...@@ -218,9 +218,8 @@ LLCoprocedurePool::LLCoprocedurePool(const std::string &poolName, size_t size): ...@@ -218,9 +218,8 @@ LLCoprocedurePool::LLCoprocedurePool(const std::string &poolName, size_t size):
mHTTPPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID), mHTTPPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID),
mCoroMapping() mCoroMapping()
{ {
// Store in our LLTempBoundListener so that when the LLCoprocedurePool is // store in our LLTempBoundListener so that when the LLCoprocedurePool is
// destroyed, we implicitly disconnect from this LLEventPump. // destroyed, we implicitly disconnect from this LLEventPump
// Run this listener before the "final" listener.
mStatusListener = LLEventPumps::instance().obtain("LLApp").listen( mStatusListener = LLEventPumps::instance().obtain("LLApp").listen(
poolName, poolName,
[this, poolName](const LLSD& status) [this, poolName](const LLSD& status)
...@@ -236,9 +235,7 @@ LLCoprocedurePool::LLCoprocedurePool(const std::string &poolName, size_t size): ...@@ -236,9 +235,7 @@ LLCoprocedurePool::LLCoprocedurePool(const std::string &poolName, size_t size):
mPendingCoprocs.close(); mPendingCoprocs.close();
} }
return false; return false;
}, });
LLEventPump::NameList{}, // after
LLEventPump::NameList{ "final "}); // before
for (size_t count = 0; count < mPoolSize; ++count) for (size_t count = 0; count < mPoolSize; ++count)
{ {
......
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