17 m_mask(cache->
fullSize(), false), m_waitNeeded(false) {}
20 if(m_waitNeeded.load(std::memory_order_acquire))
wait();
27 if(m_waitNeeded.load(std::memory_order_acquire))
wait();
33 if(m_waitNeeded.load(std::memory_order_acquire))
wait();
34 return m_map.cbegin();
38 if(m_waitNeeded.load(std::memory_order_acquire))
wait();
40 if(itr!= m_map.end() && itr->first==hashId)
return itr;
46 std::scoped_lock lock (m_waitMutex);
47 if(m_waitNeeded.load(std::memory_order_acquire) ==
false)
return;
50 while(!m_waitlist.empty()) {
53 const void* ptr = cacheLink->waitFor(hash);
54 if(ptr == ABORTstate) {
57 m_waitlist.pop_back();
60 for(
size_t i =0;i<m_mask.size();i++){
61 if(m_mask[i]) m_map.emplace_back(i,
m_cacheLink->m_vec[i].load(std::memory_order_relaxed));
65 m_waitNeeded.store(
false, std::memory_order_seq_cst);
69 int flag =
m_cacheLink->tryLock(hashId, lock, m_waitlist);
71 if(!m_waitlist.empty()) m_waitNeeded.store(
true, std::memory_order_relaxed);
74 m_mask[hashId] =
true;
75 m_waitNeeded.store(
true, std::memory_order_relaxed);
88 m_mask[hashId] =
true;
89 m_waitNeeded.store(
true, std::memory_order_relaxed);
94 if(m_waitNeeded.load(std::memory_order_acquire))
wait();
95 std::vector<IdentifierHash> ids;
96 ids.reserve(m_map.size());
97 for(
auto &
x : m_map) {
98 ids.emplace_back(
x.first);
104 if(m_waitNeeded.load(std::memory_order_acquire))
wait();
109 if(m_waitNeeded.load(std::memory_order_relaxed))
wait();
112 m_waitNeeded.store(
true, std::memory_order_relaxed);
118 if(ptr) { m_mask[hashId] =
true; m_waitNeeded.store(
true, std::memory_order_relaxed); }
119 return StatusCode::SUCCESS;
123 throw std::runtime_error(
"Not implemented");
131 std::pair<bool, const void*> cacheinserted =
m_cacheLink->add(hashId, ptr);
132 m_mask[hashId] =
true;
133 m_waitNeeded.store(
true, std::memory_order_relaxed);
134 return ptr == cacheinserted.second;
138 if(hashId < m_mask.size() and m_mask[hashId]) {
140 return cacheLink->findWait(hashId);
146 std::pair<bool, const void*> added =
m_cacheLink->addLock(hashId, ptr);
148 throw std::runtime_error(
"IDC WARNING Deletion shouldn't occur in addLock paradigm");
150 m_mask[hashId] =
true;
151 m_waitNeeded.store(
true, std::memory_order_relaxed);
152 return StatusCode::SUCCESS;
156 throw std::runtime_error(
"Do not remove things from an online IDC");
I_InternalIDC::InternalConstItr InternalConstItr
Define macros for attributes used to control the static checker.
std::vector< hashPair >::const_iterator InternalConstItr
EventContainers::hashPair< void > hashPair
void deleter_f(const void *p)
static constexpr uintptr_t ABORTEDflag
virtual std::vector< IdentifierHash > getAllCurrentHashes() const override
virtual InternalConstItr indexFind(IdentifierHash hashId) const override
std::vector< IdentifierHash > m_waitlist ATLAS_THREAD_SAFE
virtual StatusCode addLock(IdentifierHash hashId, const void *ptr) override
virtual bool insert(IdentifierHash hashId, const void *ptr) override
virtual const void * findIndexPtr(IdentifierHash hashId) const noexcept override
virtual void wait() const override
virtual void cleanUp(deleter_f *) noexcept override
virtual bool tryAddFromCache(IdentifierHash hashId, EventContainers::IDC_WriteHandleBase &lock) override
virtual size_t fullSize() const noexcept override
virtual StatusCode fetchOrCreate(IdentifierHash hashId) override
virtual void destructor(deleter_f *) noexcept override
virtual void * removeCollection(IdentifierHash hashId) override
virtual const std::vector< hashPair > & getAllHashPtrPair() const override
virtual InternalConstItr cbegin() const override
InternalOnline(EventContainers::IdentifiableCacheBase *cache)
virtual InternalConstItr cend() const override
virtual size_t numberOfCollections() const override
EventContainers::IdentifiableCacheBase * m_cacheLink
This is a "hash" representation of an Identifier.