Skip to content

Commit

Permalink
LV2: Fix postponed notifications for multiple users
Browse files Browse the repository at this point in the history
  • Loading branch information
elad335 committed Jun 5, 2023
1 parent edd4b49 commit 20b2ee8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions rpcs3/Emu/Cell/lv2/lv2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<const void*>{g_to_notify, 4}.find_first_of(std::add_pointer_t<const void>{});

if (!g_pending && g_scheduler_ready)
{
Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 20b2ee8

Please sign in to comment.