| 47 | |
| 48 | template <class T, class IndexType, IndexType CAPACITY> |
| 49 | bool WriteOnlySet<T, IndexType, CAPACITY>::eraseImpl(Index idx) { |
| 50 | while (true) { |
| 51 | auto ptr = _set[idx].load(); |
| 52 | if (ptr & LOCK) { |
| 53 | _set[idx].store(0); |
| 54 | freeList.push(reinterpret_cast<T*>(ptr ^ LOCK)); |
| 55 | return false; |
| 56 | } else { |
| 57 | if (_set[idx].compare_exchange_strong(ptr, 0)) { |
| 58 | reinterpret_cast<T*>(ptr)->delref(); |
| 59 | return true; |
| 60 | } |
| 61 | } |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | template <class T, class IndexType, IndexType CAPACITY> |
| 66 | bool WriteOnlySet<T, IndexType, CAPACITY>::erase(Index idx) { |