1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +03:00

Simpler OAM

This commit is contained in:
Leonid Fedorov
2023-04-25 18:25:01 +00:00
parent bab29ff495
commit aead012f9f
4 changed files with 33 additions and 50 deletions

View File

@ -36,39 +36,24 @@ using namespace boost;
#include "installdir.h"
#include "mcsconfig.h"
namespace
{
oam::OamCache* oamCache = nullptr;
boost::mutex cacheLock;
} // namespace
namespace oam
{
std::atomic_bool hasOAMCache{false};
struct CacheReloaded
{
CacheReloaded()
{
oamcache.checkReload();
}
OamCache oamcache;
};
OamCache* OamCache::makeOamCache()
{
if (!hasOAMCache.load(std::memory_order_relaxed))
{
boost::mutex::scoped_lock lk(cacheLock);
if (oamCache == nullptr)
{
oamCache = new OamCache();
oamCache->checkReload();
hasOAMCache.store(true, std::memory_order_relaxed);
}
}
return oamCache;
}
OamCache::OamCache() : mtime(0), mLocalPMId(0)
{
}
OamCache::~OamCache()
{
static CacheReloaded cache;
return &cache.oamcache;
}
void OamCache::checkReload()