40 const void *ptr1 =
nullptr;
42 if(
m_vec[
hash].compare_exchange_strong(ptr1,
INVALID, std::memory_order_relaxed, std::memory_order_relaxed)){
51 wait.emplace_back(
hash);
63 for (
size_t i=0;
i<
s ;
i++) {
64 const void*
ptr =
m_vec[
i].load(std::memory_order_relaxed);
65 m_vec[
i].store(
nullptr, std::memory_order_relaxed);
72 for (
size_t i=0;
i<
s ;
i++)
m_vec[
i].
store(
nullptr, std::memory_order_relaxed);
80 std::atomic_thread_fence(std::memory_order_acquire);
83 for (
size_t i=0;
i<
s ;
i++) {
84 const void*
p =
m_vec[
i].load(std::memory_order_relaxed);
91 const void*
p =
m_vec[
hash].load(std::memory_order_relaxed);
97 const void*
p =
m_vec[
hash].load(std::memory_order_relaxed);
105 const void*
p = m_vec[
hash].load(std::memory_order_acquire);
113 std::atomic<const void*> &myatomic =
m_vec[
hash];
114 const void*
item = myatomic.load(std::memory_order_acquire);
117 myatomic.wait(
item, std::memory_order_relaxed);
118 item = myatomic.load(std::memory_order_acquire);
139 const void*
ptr =
nullptr;
192 std::vector<IdentifierHash> ret;
195 for (
size_t i =0;
i<
s;
i++) {
196 const void*
p =
m_vec[
i].load(std::memory_order_relaxed);
206 if (
ATH_UNLIKELY(
hash >= m_vec.size()))
return std::make_pair(
false,
nullptr);
207 if(
p==
nullptr)
return std::make_pair(
false,
nullptr);
208 const void* nul=
nullptr;
209 if(m_vec[
hash].compare_exchange_strong(nul,
p, std::memory_order_release, std::memory_order_relaxed)){
210 m_currentHashes.fetch_add(1, std::memory_order_relaxed);
211 return std::make_pair(
true,
p);
214 if(m_vec[
hash].compare_exchange_strong(invalid,
p, std::memory_order_release, std::memory_order_acquire)){
215 m_currentHashes.fetch_add(1, std::memory_order_relaxed);
217 return std::make_pair(
true,
p);
219 return std::make_pair(
false, invalid);
226 assert(
hash < m_vec.size());
227 if(
p==
nullptr)
return std::make_pair(
false,
nullptr);
229 if(m_vec[
hash].compare_exchange_strong(invalid,
p, std::memory_order_release, std::memory_order_relaxed)){
230 m_currentHashes.fetch_add(1, std::memory_order_relaxed);
232 return std::make_pair(
true,
p);
234 const void* nul=
nullptr;
235 if(m_vec[
hash].compare_exchange_strong(nul,
p, std::memory_order_release, std::memory_order_acquire)){
236 m_currentHashes.fetch_add(1, std::memory_order_relaxed);
237 return std::make_pair(
true,
p);
239 return std::make_pair(
false, nul);
245 std::pair<bool, const void*>
b = addLock(
hash,
p.get());
246 if(
b.first)
p.release();
254 std::pair<bool, const void*>
b =
add(
hash,
p.get());
255 if(
b.first)
p.release();