25 std::scoped_lock lock (m_waitMutex);
26 if(m_needsupdate.load(std::memory_order_acquire) ==
false)
return;
28 for(
size_t i=0 ;i <
m_fullMap.size(); ++i){
31 m_map.shrink_to_fit();
32 m_needsupdate.store(
false, std::memory_order_release);
36 if(m_needsupdate.load(std::memory_order_acquire))
wait();
37 std::vector<IdentifierHash> ids;
38 ids.reserve(m_map.size());
39 for(
auto &
x : m_map) {
40 ids.emplace_back(
x.first);
47 if(m_needsupdate.load(std::memory_order_acquire))
wait();
52 if(m_needsupdate.load(std::memory_order_acquire))
wait();
58 if(m_needsupdate.load(std::memory_order_acquire))
wait();
59 return m_map.cbegin();
63 if(m_needsupdate.load(std::memory_order_acquire))
wait();
65 if(itr!= m_map.cend() && itr->first==hashId)
return itr;
70 if(m_needsupdate.load(std::memory_order_acquire))
wait();
75 if(!m_needsupdate.load(std::memory_order_acquire)) {
76 for(
const auto&
x : m_map) { deleter(
x.second);
m_fullMap[
x.first] =
nullptr; }
77 if(!m_map.empty()) m_needsupdate.store(
true, std::memory_order_relaxed);
80 for(
size_t i=0 ;i <
m_fullMap.size(); ++i){
88 if(
m_fullMap[hashId]!=
nullptr)
return false;
90 m_needsupdate.store(
true, std::memory_order_relaxed);
95 if(hashId >=
m_fullMap.size())
return nullptr;
100 bool added =
insert(hashId, ptr);
102 throw std::runtime_error(
"IDC WARNING Deletion shouldn't occur in addLock paradigm");
104 return StatusCode::SUCCESS;
110 m_needsupdate.store(
true, std::memory_order_relaxed);
115 throw std::runtime_error(
"Not implemented in offline mode");
119 throw std::runtime_error(
"Not implemented in offline mode");
123 if(!m_needsupdate.load(std::memory_order_acquire))
for(
const auto&
x : m_map) deleter(
x.second);
125 for(
size_t i=0 ;i <
m_fullMap.size(); ++i){
I_InternalIDC::InternalConstItr InternalConstItr
std::vector< hashPair >::const_iterator InternalConstItr
EventContainers::hashPair< void > hashPair
void deleter_f(const void *p)
virtual bool insert(IdentifierHash hashId, const void *ptr) override
virtual InternalConstItr cend() const override
virtual const std::vector< hashPair > & getAllHashPtrPair() const override
virtual const void * findIndexPtr(IdentifierHash hashId) const noexcept override
virtual std::vector< IdentifierHash > getAllCurrentHashes() const override
virtual StatusCode fetchOrCreate(IdentifierHash hashId) override
virtual void wait() const override
virtual bool tryAddFromCache(IdentifierHash hashId, EventContainers::IDC_WriteHandleBase &lock) override
virtual InternalConstItr cbegin() const override
virtual InternalConstItr indexFind(IdentifierHash hashId) const override
std::vector< const void * > m_fullMap
virtual void * removeCollection(IdentifierHash hashId) override
virtual void destructor(deleter_f *) noexcept override
virtual size_t numberOfCollections() const override
InternalOfflineFast(size_t max)
virtual void cleanUp(deleter_f *deleter) noexcept override
std::vector< I_InternalIDC::hashPair > m_map ATLAS_THREAD_SAFE
virtual StatusCode addLock(IdentifierHash hashId, const void *ptr) override
This is a "hash" representation of an Identifier.