You've already forked mariadb-columnstore-engine
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:
@ -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()
|
||||
|
Reference in New Issue
Block a user