diff options
Diffstat (limited to 'indra/llcommon/lleventcoro.cpp')
-rw-r--r-- | indra/llcommon/lleventcoro.cpp | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/indra/llcommon/lleventcoro.cpp b/indra/llcommon/lleventcoro.cpp index cea5a1eda3..d598f1cc4a 100644 --- a/indra/llcommon/lleventcoro.cpp +++ b/indra/llcommon/lleventcoro.cpp @@ -20,20 +20,31 @@ // other Linden headers #include "llsdserialize.h" #include "llerror.h" +#include "llcoros.h" -std::string LLEventDetail::listenerNameForCoro(const void* self) +std::string LLEventDetail::listenerNameForCoroImpl(const void* self_id) { + // First, if this coroutine was launched by LLCoros::launch(), find that name. + std::string name(LLCoros::instance().getNameByID(self_id)); + if (! name.empty()) + { + return name; + } + // Apparently this coroutine wasn't launched by LLCoros::launch(). Check + // whether we have a memo for this self_id. typedef std::map<const void*, std::string> MapType; static MapType memo; - MapType::const_iterator found = memo.find(self); + MapType::const_iterator found = memo.find(self_id); if (found != memo.end()) { // this coroutine instance has called us before, reuse same name return found->second; } // this is the first time we've been called for this coroutine instance - std::string name(LLEventPump::inventName("coro")); - memo[self] = name; + name = LLEventPump::inventName("coro"); + memo[self_id] = name; + LL_INFOS("LLEventCoro") << "listenerNameForCoroImpl(" << self_id << "): inventing coro name '" + << name << "'" << LL_ENDL; return name; } |