DRTVWR-476, SL-12197: Don't throw Stopping from main coroutine.
The new LLCoros::Stop exception is intended to terminate long-lived coroutines -- not interrupt mainstream shutdown processing. Only throw it on an explicitly-launched coroutine. Make LLCoros::getName() (used by the above test) static. As with other LLCoros methods, it might be called after the LLCoros LLSingleton instance has been deleted. Requiring the caller to call instance() implies a possible need to also call wasDeleted(). Encapsulate that nuance into a static method instead.master
parent
95cf6dddae
commit
2a56ab4436
|
|
@ -192,7 +192,8 @@ bool LLCoros::kill(const std::string& name)
|
|||
}
|
||||
|*==========================================================================*/
|
||||
|
||||
std::string LLCoros::getName() const
|
||||
//static
|
||||
std::string LLCoros::getName()
|
||||
{
|
||||
return get_CoroData("getName()").mName;
|
||||
}
|
||||
|
|
@ -320,12 +321,21 @@ void LLCoros::toplevel(std::string name, callable_t callable)
|
|||
}
|
||||
}
|
||||
|
||||
//static
|
||||
void LLCoros::checkStop()
|
||||
{
|
||||
if (wasDeleted())
|
||||
{
|
||||
LLTHROW(Shutdown("LLCoros was deleted"));
|
||||
}
|
||||
// do this AFTER the check above, because getName() depends on
|
||||
// get_CoroData(), which depends on the local_ptr in our instance().
|
||||
if (getName().empty())
|
||||
{
|
||||
// Our Stop exception and its subclasses are intended to stop loitering
|
||||
// coroutines. Don't throw it from the main coroutine.
|
||||
return;
|
||||
}
|
||||
if (LLApp::isStopped())
|
||||
{
|
||||
LLTHROW(Stopped("viewer is stopped"));
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ public:
|
|||
* (e.g. if the coroutine was launched by hand rather than using
|
||||
* LLCoros::launch()).
|
||||
*/
|
||||
std::string getName() const;
|
||||
static std::string getName();
|
||||
|
||||
/**
|
||||
* For delayed initialization. To be clear, this will only affect
|
||||
|
|
@ -295,7 +295,7 @@ inline
|
|||
std::string logname()
|
||||
{
|
||||
static std::string main("main");
|
||||
std::string name(LLCoros::instance().getName());
|
||||
std::string name(LLCoros::getName());
|
||||
return name.empty()? main : name;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ namespace
|
|||
std::string listenerNameForCoro()
|
||||
{
|
||||
// If this coroutine was launched by LLCoros::launch(), find that name.
|
||||
std::string name(LLCoros::instance().getName());
|
||||
std::string name(LLCoros::getName());
|
||||
if (! name.empty())
|
||||
{
|
||||
return name;
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ LLAvatarNameCache::~LLAvatarNameCache()
|
|||
|
||||
void LLAvatarNameCache::requestAvatarNameCache_(std::string url, std::vector<LLUUID> agentIds)
|
||||
{
|
||||
LL_DEBUGS("AvNameCache") << "Entering coroutine " << LLCoros::instance().getName()
|
||||
LL_DEBUGS("AvNameCache") << "Entering coroutine " << LLCoros::getName()
|
||||
<< " with url '" << url << "', requesting " << agentIds.size() << " Agent Ids" << LL_ENDL;
|
||||
|
||||
// Check pointer that can be cleaned up by cleanupClass()
|
||||
|
|
@ -188,7 +188,7 @@ void LLAvatarNameCache::requestAvatarNameCache_(std::string url, std::vector<LLU
|
|||
}
|
||||
catch (...)
|
||||
{
|
||||
LOG_UNHANDLED_EXCEPTION(STRINGIZE("coroutine " << LLCoros::instance().getName()
|
||||
LOG_UNHANDLED_EXCEPTION(STRINGIZE("coroutine " << LLCoros::getName()
|
||||
<< "('" << url << "', " << agentIds.size()
|
||||
<< " http result: " << httpResults.asString()
|
||||
<< " Agent Ids)"));
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ LLAccountingCostManager::LLAccountingCostManager()
|
|||
void LLAccountingCostManager::accountingCostCoro(std::string url,
|
||||
eSelectionType selectionType, const LLHandle<LLAccountingCostObserver> observerHandle)
|
||||
{
|
||||
LL_DEBUGS("LLAccountingCostManager") << "Entering coroutine " << LLCoros::instance().getName()
|
||||
LL_DEBUGS("LLAccountingCostManager") << "Entering coroutine " << LLCoros::getName()
|
||||
<< " with url '" << url << LL_ENDL;
|
||||
|
||||
LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID);
|
||||
|
|
@ -158,7 +158,7 @@ void LLAccountingCostManager::accountingCostCoro(std::string url,
|
|||
}
|
||||
catch (...)
|
||||
{
|
||||
LOG_UNHANDLED_EXCEPTION(STRINGIZE("coroutine " << LLCoros::instance().getName()
|
||||
LOG_UNHANDLED_EXCEPTION(STRINGIZE("coroutine " << LLCoros::getName()
|
||||
<< "('" << url << "')"));
|
||||
throw;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ void LLLogin::Impl::loginCoro(std::string uri, LLSD login_params)
|
|||
}
|
||||
try
|
||||
{
|
||||
LL_DEBUGS("LLLogin") << "Entering coroutine " << LLCoros::instance().getName()
|
||||
LL_DEBUGS("LLLogin") << "Entering coroutine " << LLCoros::getName()
|
||||
<< " with uri '" << uri << "', parameters " << printable_params << LL_ENDL;
|
||||
|
||||
LLEventPump& xmlrpcPump(LLEventPumps::instance().obtain("LLXMLRPCTransaction"));
|
||||
|
|
@ -307,7 +307,7 @@ void LLLogin::Impl::loginCoro(std::string uri, LLSD login_params)
|
|||
sendProgressEvent("offline", "fail.login", error_response);
|
||||
}
|
||||
catch (...) {
|
||||
CRASH_ON_UNHANDLED_EXCEPTION(STRINGIZE("coroutine " << LLCoros::instance().getName()
|
||||
CRASH_ON_UNHANDLED_EXCEPTION(STRINGIZE("coroutine " << LLCoros::getName()
|
||||
<< "('" << uri << "', " << printable_params << ")"));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue