diff options
Diffstat (limited to 'indra/llcommon')
-rw-r--r-- | indra/llcommon/llcoros.cpp | 12 | ||||
-rw-r--r-- | indra/llcommon/llcoros.h | 4 | ||||
-rw-r--r-- | indra/llcommon/lleventcoro.cpp | 2 |
3 files changed, 14 insertions, 4 deletions
diff --git a/indra/llcommon/llcoros.cpp b/indra/llcommon/llcoros.cpp index febe74b559..5f940de52b 100644 --- a/indra/llcommon/llcoros.cpp +++ b/indra/llcommon/llcoros.cpp @@ -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")); diff --git a/indra/llcommon/llcoros.h b/indra/llcommon/llcoros.h index 7b3420cc8f..2e4cd8ccad 100644 --- a/indra/llcommon/llcoros.h +++ b/indra/llcommon/llcoros.h @@ -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; } diff --git a/indra/llcommon/lleventcoro.cpp b/indra/llcommon/lleventcoro.cpp index 967c4d74d8..11b6e5bb2f 100644 --- a/indra/llcommon/lleventcoro.cpp +++ b/indra/llcommon/lleventcoro.cpp @@ -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; |