From 4e26c342d72069b59a829bd6c9e38a2b142c2b3c Mon Sep 17 00:00:00 2001 From: Eladash Date: Mon, 5 Jun 2023 14:21:21 +0300 Subject: [PATCH] LV2: Fix postponed notifications for multiple users --- rpcs3/Emu/Cell/lv2/lv2.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rpcs3/Emu/Cell/lv2/lv2.cpp b/rpcs3/Emu/Cell/lv2/lv2.cpp index 457a789554aa..1ef497a12a0a 100644 --- a/rpcs3/Emu/Cell/lv2/lv2.cpp +++ b/rpcs3/Emu/Cell/lv2/lv2.cpp @@ -1644,7 +1644,7 @@ void lv2_obj::cleanup() void lv2_obj::schedule_all(u64 current_time) { - usz notify_later_idx = 0; + usz notify_later_idx = std::basic_string_view{g_to_notify, 4}.find_first_of(nullptr); if (!g_pending && g_scheduler_ready) { @@ -1663,7 +1663,7 @@ void lv2_obj::schedule_all(u64 current_time) continue; } - if (notify_later_idx == std::size(g_to_notify)) + if (notify_later_idx >= std::size(g_to_notify)) { // Out of notification slots, notify locally (resizable container is not worth it) target->state.notify_one(cpu_flag::signal + cpu_flag::suspend); @@ -1697,7 +1697,7 @@ void lv2_obj::schedule_all(u64 current_time) ensure(!target->state.test_and_set(cpu_flag::notify)); // Otherwise notify it to wake itself - if (notify_later_idx == std::size(g_to_notify)) + if (notify_later_idx >= std::size(g_to_notify)) { // Out of notification slots, notify locally (resizable container is not worth it) target->state.notify_one(cpu_flag::notify);