DRTVWR-476: Introduce LLCoprocedureManager::close(). Use in tests.

The new close(void) method simply acquires the logic from
~LLCoprocedureManager() (which now calls close()). It's useful, even if only
in test programs, to be able to shut down all existing LLCoprocedurePools
without having to name them individually -- and without having to destroy the
LLCoprocedureManager singleton instance. Deleting an LLSingleton should be
done only once per process, whereas test programs want to reset the
LLCoprocedureManager after each test.
meow-7.2.2
Nat Goodspeed 2019-11-15 08:17:04 -05:00
parent a8ef51170d
commit a6cd80f8bf
3 changed files with 15 additions and 4 deletions

View File

@ -134,10 +134,7 @@ LLCoprocedureManager::LLCoprocedureManager()
LLCoprocedureManager::~LLCoprocedureManager()
{
for(auto & poolEntry : mPoolMap)
{
poolEntry.second->close();
}
close();
}
LLCoprocedureManager::poolPtr_t LLCoprocedureManager::initializePool(const std::string &poolName)
@ -255,6 +252,14 @@ size_t LLCoprocedureManager::count(const std::string &pool) const
return it->second->count();
}
void LLCoprocedureManager::close()
{
for(auto & poolEntry : mPoolMap)
{
poolEntry.second->close();
}
}
void LLCoprocedureManager::close(const std::string &pool)
{
poolMap_t::iterator it = mPoolMap.find(pool);

View File

@ -77,6 +77,7 @@ public:
size_t count() const;
size_t count(const std::string &pool) const;
void close();
void close(const std::string &pool);
private:

View File

@ -75,6 +75,11 @@ namespace tut
coproceduremanager_test()
{
}
~coproceduremanager_test()
{
LLCoprocedureManager::instance().close();
}
};
typedef test_group<coproceduremanager_test> coproceduremanager_t;
typedef coproceduremanager_t::object coproceduremanager_object_t;