MCPcopy Create free account
hub / github.com/cameron314/concurrentqueue / remove

Method remove

tests/relacy/spmchash.cpp:66–75  ·  view source on GitHub ↗

Thread-safe, but if somebody else can remove the same key while remove() is in progress, then any removed value is not guaranteed to correspond to that key This also applies if the key was not already present but once was. Elements can be removed in an order.

Source from the content-addressed store, hash-verified

64 // to that key This also applies if the key was not already present but
65 // once was. Elements can be removed in an order.
66 TValue* remove(std::uint64_t key)
67 {
68 auto idxEntry = get_entry_for_key(key);
69 if (idxEntry == nullptr)
70 return nullptr;
71 TValue* val = nullptr;
72 while (!idxEntry->value.compare_exchange_weak(val, nullptr, std::memory_order_acquire, std::memory_order_relaxed))
73 continue;
74 return val;
75 }
76
77private:
78 struct IndexEntry

Callers 1

threadMethod · 0.45

Calls 1

compare_exchange_weakMethod · 0.45

Tested by

no test coverage detected