1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 10:42:36 +01:00

Fix lf_queue regression

This commit is contained in:
Ivan Chikish 2023-08-03 05:18:58 +03:00 committed by Elad Ashkenazi
parent d34287b2cc
commit 39a0ff99b2

View File

@ -342,15 +342,14 @@ public:
void push(Args&&... args) void push(Args&&... args)
{ {
auto oldv = m_head.load(); auto oldv = m_head.load();
auto _old = load(oldv); auto item = new lf_queue_item<T>(load(oldv), std::forward<Args>(args)...);
auto item = new lf_queue_item<T>(_old, std::forward<Args>(args)...);
while (!m_head.compare_exchange(oldv, reinterpret_cast<u64>(item) << 16)) while (!m_head.compare_exchange(oldv, reinterpret_cast<u64>(item) << 16))
{ {
item->m_link = _old; item->m_link = load(oldv);
} }
if (!_old) if (!oldv)
{ {
// Notify only if queue was empty // Notify only if queue was empty
utils::bless<atomic_t<u32>>(&m_head)[1].notify_one(); utils::bless<atomic_t<u32>>(&m_head)[1].notify_one();