| 54 | inline T* tail() { return tail_.load(std::memory_order_acquire); } |
| 55 | |
| 56 | void add(T* element) |
| 57 | { |
| 58 | assert(element != nullptr); |
| 59 | |
| 60 | // Add it to the lock-free list |
| 61 | auto prevTail = tail_.load(std::memory_order_relaxed); |
| 62 | do { |
| 63 | element->concurrentListPrev = prevTail; |
| 64 | } while (!tail_.compare_exchange_weak(prevTail, element, std::memory_order_release, std::memory_order_relaxed)); |
| 65 | } |
| 66 | |
| 67 | private: |
| 68 | std::atomic<T*> tail_; |
nothing calls this directly
no test coverage detected