summaryrefslogtreecommitdiff
path: root/indra/llmessage
diff options
context:
space:
mode:
authorDave Houlton <euclid@lindenlab.com>2021-07-19 15:55:57 -0600
committerDave Houlton <euclid@lindenlab.com>2021-07-19 15:55:57 -0600
commit4c849ba91363f82da05cce1221b04075a6ca72af (patch)
tree33edfb0495161594a50dcfbed3a3f42e7fde9143 /indra/llmessage
parentdc14dbf54d332a6cdc43002bb71ed71e9a473647 (diff)
parentbe6066eae218856f7fd74b98968a75e5062fa830 (diff)
Merge branch 'master' v 6.4.22 into DRTVWR-528
Diffstat (limited to 'indra/llmessage')
-rw-r--r--indra/llmessage/llcoproceduremanager.cpp29
-rw-r--r--indra/llmessage/llcoproceduremanager.h4
-rw-r--r--indra/llmessage/llexperiencecache.cpp2
-rw-r--r--indra/llmessage/tests/llcoproceduremanager_test.cpp1
4 files changed, 28 insertions, 8 deletions
diff --git a/indra/llmessage/llcoproceduremanager.cpp b/indra/llmessage/llcoproceduremanager.cpp
index 4d76dacdf7..be014e7b1e 100644
--- a/indra/llmessage/llcoproceduremanager.cpp
+++ b/indra/llmessage/llcoproceduremanager.cpp
@@ -138,13 +138,24 @@ LLCoprocedureManager::~LLCoprocedureManager()
close();
}
-LLCoprocedureManager::poolPtr_t LLCoprocedureManager::initializePool(const std::string &poolName)
+void LLCoprocedureManager::initializePool(const std::string &poolName)
{
+ poolMap_t::iterator it = mPoolMap.find(poolName);
+
+ if (it != mPoolMap.end())
+ {
+ // Pools are not supposed to be initialized twice
+ // Todo: ideally restrict init to STATE_FIRST
+ LL_ERRS() << "Pool is already present " << poolName << LL_ENDL;
+ return;
+ }
+
// Attempt to look up a pool size in the configuration. If found use that
std::string keyName = "PoolSize" + poolName;
int size = 0;
LL_ERRS_IF(poolName.empty(), "CoprocedureManager") << "Poolname must not be empty" << LL_ENDL;
+ LL_INFOS("CoprocedureManager") << "Initializing pool " << poolName << LL_ENDL;
if (mPropertyQueryFn)
{
@@ -171,8 +182,6 @@ LLCoprocedureManager::poolPtr_t LLCoprocedureManager::initializePool(const std::
bool inserted = mPoolMap.emplace(poolName, pool).second;
LL_ERRS_IF(!inserted, "CoprocedureManager") << "Unable to add pool named \"" << poolName << "\" to map. FATAL!" << LL_ENDL;
-
- return pool;
}
//-------------------------------------------------------------------------
@@ -182,20 +191,28 @@ LLUUID LLCoprocedureManager::enqueueCoprocedure(const std::string &pool, const s
// not exist, create it.
poolMap_t::iterator it = mPoolMap.find(pool);
- poolPtr_t targetPool = (it != mPoolMap.end()) ? it->second : initializePool(pool);
+ if (it == mPoolMap.end())
+ {
+ // initializing pools in enqueueCoprocedure is not thread safe,
+ // at the moment pools need to be initialized manually
+ LL_ERRS() << "Uninitialized pool " << pool << LL_ENDL;
+ }
+ poolPtr_t targetPool = it->second;
return targetPool->enqueueCoprocedure(name, proc);
}
void LLCoprocedureManager::setPropertyMethods(SettingQuery_t queryfn, SettingUpdate_t updatefn)
{
// functions to discover and store the pool sizes
+ // Might be a better idea to make an initializePool(name, size) to init everything externally
mPropertyQueryFn = queryfn;
mPropertyDefineFn = updatefn;
- // workaround until we get mutex into initializePool
- initializePool("AssetStorage");
initializePool("Upload");
+ initializePool("AIS"); // it might be better to have some kind of on-demand initialization for AIS
+ // "ExpCache" pool gets initialized in LLExperienceCache
+ // asset storage pool gets initialized in LLViewerAssetStorage
}
//-------------------------------------------------------------------------
diff --git a/indra/llmessage/llcoproceduremanager.h b/indra/llmessage/llcoproceduremanager.h
index d5557c129f..2d460826ff 100644
--- a/indra/llmessage/llcoproceduremanager.h
+++ b/indra/llmessage/llcoproceduremanager.h
@@ -79,6 +79,8 @@ public:
void close();
void close(const std::string &pool);
+
+ void initializePool(const std::string &poolName);
private:
@@ -87,8 +89,6 @@ private:
poolMap_t mPoolMap;
- poolPtr_t initializePool(const std::string &poolName);
-
SettingQuery_t mPropertyQueryFn;
SettingUpdate_t mPropertyDefineFn;
diff --git a/indra/llmessage/llexperiencecache.cpp b/indra/llmessage/llexperiencecache.cpp
index 64c01bd9eb..db22ad2ea3 100644
--- a/indra/llmessage/llexperiencecache.cpp
+++ b/indra/llmessage/llexperiencecache.cpp
@@ -108,6 +108,8 @@ void LLExperienceCache::initSingleton()
cache_stream >> (*this);
}
+ LLCoprocedureManager::instance().initializePool("ExpCache");
+
LLCoros::instance().launch("LLExperienceCache::idleCoro",
boost::bind(&LLExperienceCache::idleCoro, this));
diff --git a/indra/llmessage/tests/llcoproceduremanager_test.cpp b/indra/llmessage/tests/llcoproceduremanager_test.cpp
index 9db13a37b5..6424117ef3 100644
--- a/indra/llmessage/tests/llcoproceduremanager_test.cpp
+++ b/indra/llmessage/tests/llcoproceduremanager_test.cpp
@@ -91,6 +91,7 @@ namespace tut
{
Sync sync;
int foo = 0;
+ LLCoprocedureManager::instance().initializePool("PoolName");
LLUUID queueId = LLCoprocedureManager::instance().enqueueCoprocedure("PoolName", "ProcName",
[&foo, &sync] (LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t & ptr, const LLUUID & id) {
sync.bump();