43 template <
class T, AtomicIntrusiveLinkedListHook<T> T::*HookMember>
51 auto tmp = other.head_.load();
52 other.head_ = head_.load();
57 auto tmp = other.head_.load();
58 other.head_ = head_.load();
72 return head_.load() ==
nullptr;
81 assert(
next(t) ==
nullptr);
83 auto oldHead = head_.load(std::memory_order_relaxed);
92 }
while (!head_.compare_exchange_weak(
93 oldHead, t, std::memory_order_release, std::memory_order_relaxed));
95 return oldHead ==
nullptr;
103 template <
typename F>
105 if (
auto head = head_.exchange(
nullptr)) {
106 auto rhead = reverse(head);
107 unlinkAll(rhead, std::forward<F>(func));
118 template <
typename F>
120 while (sweepOnce(func)) {
137 template <
typename F>
141 auto head = head_.exchange(
nullptr);
142 unlinkAll(head, std::forward<F>(func));
146 std::atomic<T*> head_{
nullptr};
149 return (t->*HookMember).next;
156 while (head !=
nullptr) {
167 template <
typename F>
169 while (head !=
nullptr) {
void reverseSweep(F &&func)
AtomicIntrusiveLinkedList & operator=(AtomicIntrusiveLinkedList &&other) noexcept
—— Concurrent Priority Queue Implementation ——
requires E e noexcept(noexcept(s.error(std::move(e))))
void unlinkAll(T *head, F &&func)
constexpr auto empty(C const &c) -> decltype(c.empty())
~AtomicIntrusiveLinkedList()
static T * reverse(T *head)
AtomicIntrusiveLinkedList(AtomicIntrusiveLinkedList &&other) noexcept
AtomicIntrusiveLinkedList()