summaryrefslogtreecommitdiff
path: root/indra/test
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2024-10-22 09:44:43 -0400
committerNat Goodspeed <nat@lindenlab.com>2024-10-22 09:44:43 -0400
commita76209d099c3a18967d26e5b091f83e9ae9fd6a1 (patch)
tree878c3d90d6f48c4fbaa6130a50181f3c6af187f5 /indra/test
parentfc1c5635d38bceb70132bddf6454e07be61acec2 (diff)
Eliminate double names for coros + "empty name is main" convention.
Instead, introduce bool CoroData::isMain and test that. Use "main" for the name of the main coroutine. That eliminates the logname() method, also the llcoro::logname() free function. It also obviates the alternate CoroData constructor. Use boost::fibers::fiber::id as the LLInstanceTracker key for CoroData, instead of the coroutine name. Introduce get_CoroData(id), also getName(id). Extract static CoroData for the main coroutine to main_CoroData() so both get_CoroData() overloads can use it. Ditch unused get_CoroData(string) parameter: now get_CoroData(). Introduce LLCoros::mNameMap for lookup by name (e.g. killreq()). CoroData's constructor puts an entry into mNameMap; the destructor removes it. Since mNameMap is thread_local (unlike an LLInstanceTracker key), that theoretically permits duplicate coroutine names on different threads. Introduce mPrefixMap to help generate distinct coroutine names, instead of a single scalar. Introduce CoroData::getName(), and use it in both LLCoros::getName() overloads. CoroData::getName() appends mStatus if it's not empty. This is useful for disambiguating generic pool coroutines based on the current task.
Diffstat (limited to 'indra/test')
-rw-r--r--indra/test/sync.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/indra/test/sync.h b/indra/test/sync.h
index 82eef1e5f5..abeb4e17a8 100644
--- a/indra/test/sync.h
+++ b/indra/test/sync.h
@@ -69,7 +69,7 @@ public:
// misleading, as it will be emitted after waiting threads have
// already awakened. But emitting the log message within the lock
// would seem to hold the lock longer than we really ought.
- LL_DEBUGS() << llcoro::logname() << " bump(" << n << ") -> " << updated << LL_ENDL;
+ LL_DEBUGS() << LLCoros::getName() << " bump(" << n << ") -> " << updated << LL_ENDL;
}
/**
@@ -82,7 +82,7 @@ public:
*/
void set(int n)
{
- LL_DEBUGS() << llcoro::logname() << " set(" << n << ")" << LL_ENDL;
+ LL_DEBUGS() << LLCoros::getName() << " set(" << n << ")" << LL_ENDL;
mCond.set_all(n);
}
@@ -101,7 +101,7 @@ public:
private:
void yield_until(const char* func, int arg, int until)
{
- std::string name(llcoro::logname());
+ std::string name(LLCoros::getName());
LL_DEBUGS() << name << " yield_until(" << until << ") suspending" << LL_ENDL;
if (! mCond.wait_for_equal(mTimeout, until))
{