diff --git a/Utilities/lockless.h b/Utilities/lockless.h index ef19fa3f7e..7bd0133346 100644 --- a/Utilities/lockless.h +++ b/Utilities/lockless.h @@ -342,15 +342,14 @@ public: void push(Args&&... args) { auto oldv = m_head.load(); - auto _old = load(oldv); - auto item = new lf_queue_item(_old, std::forward(args)...); + auto item = new lf_queue_item(load(oldv), std::forward(args)...); while (!m_head.compare_exchange(oldv, reinterpret_cast(item) << 16)) { - item->m_link = _old; + item->m_link = load(oldv); } - if (!_old) + if (!oldv) { // Notify only if queue was empty utils::bless>(&m_head)[1].notify_one();