From 72437b50b4f4c22fda886e409cd4bf90c8adaaed Mon Sep 17 00:00:00 2001 From: Elad <18193363+elad335@users.noreply.github.com> Date: Tue, 12 Nov 2024 13:31:26 +0200 Subject: [PATCH] LV2: Fix thread notifications regression --- rpcs3/Emu/Cell/lv2/lv2.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/rpcs3/Emu/Cell/lv2/lv2.cpp b/rpcs3/Emu/Cell/lv2/lv2.cpp index 247c32ef12..1570558278 100644 --- a/rpcs3/Emu/Cell/lv2/lv2.cpp +++ b/rpcs3/Emu/Cell/lv2/lv2.cpp @@ -1341,12 +1341,12 @@ bool lv2_obj::sleep(cpu_thread& cpu, const u64 timeout) } else if (auto it = std::find(g_to_notify, std::end(g_to_notify), std::add_pointer_t{}); it != std::end(g_to_notify)) { - *it = vm::reservation_notifier_notify(addr, true); + *it++ = vm::reservation_notifier_notify(addr, true); - if (it < std::end(g_to_notify) - 1) + if (it < std::end(g_to_notify)) { // Null-terminate the list if it ends before last slot - *(it + 1) = nullptr; + *it = nullptr; } } else @@ -1394,12 +1394,12 @@ bool lv2_obj::awake(cpu_thread* thread, s32 prio) } else if (auto it = std::find(g_to_notify, std::end(g_to_notify), std::add_pointer_t{}); it != std::end(g_to_notify)) { - *it = vm::reservation_notifier_notify(addr, true); + *it++ = vm::reservation_notifier_notify(addr, true); - if (it < std::end(g_to_notify) - 1) + if (it < std::end(g_to_notify)) { // Null-terminate the list if it ends before last slot - *(it + 1) = nullptr; + *it = nullptr; } } else @@ -1908,10 +1908,10 @@ void lv2_obj::schedule_all(u64 current_time) } } - if (it < std::end(g_to_notify) - 1) + if (it < std::end(g_to_notify)) { // Null-terminate the list if it ends before last slot - *(it + 1) = nullptr; + *it = nullptr; } if (const u64 freq = s_yield_frequency)