Thread-safe, but if somebody can remove the key while find() is in progress, then any returned 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 found in any order.
| 52 | // to that key. This also applies if the key was not already present but |
| 53 | // once was. Elements can be found in any order. |
| 54 | TValue* find(std::uint64_t key) |
| 55 | { |
| 56 | auto idxEntry = get_entry_for_key(key); |
| 57 | if (idxEntry == nullptr) |
| 58 | return nullptr; |
| 59 | return idxEntry->value.load(std::memory_order_acquire); |
| 60 | } |
| 61 | |
| 62 | // Thread-safe, but if somebody else can remove the same key while remove() |
| 63 | // is in progress, then any removed value is not guaranteed to correspond |