Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sys_timer: Hotfix for stability improvements #13945

Merged
merged 6 commits into from Jun 3, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 9 additions & 6 deletions rpcs3/Emu/Cell/lv2/sys_timer.cpp
Expand Up @@ -95,7 +95,7 @@ u64 lv2_timer::check_unlocked(u64 _now) noexcept
// Set next expiration time and check again
const u64 expire0 = utils::add_saturate<u64>(next, period);
expire.release(expire0);
return expire0 - _now;
return utils::sub_saturate<u64>(expire0, _now);
}

// Stop after oneshot
Expand Down Expand Up @@ -144,13 +144,16 @@ void lv2_timer_thread::operator()()

for (const auto& timer : timers)
{
if (lv2_obj::check(timer))
while (lv2_obj::check(timer))
{
const u64 advised_sleep_time = timer->check(_now);

if (sleep_time > advised_sleep_time)
if (const u64 advised_sleep_time = timer->check(_now))
{
sleep_time = advised_sleep_time;
if (sleep_time > advised_sleep_time)
{
sleep_time = advised_sleep_time;
}

break;
}
}
}
Expand Down