mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-06 15:01:28 +12:00
Improve cpu_flag::yield handling
This commit is contained in:
parent
ec59f4d37e
commit
148edc005a
2 changed files with 6 additions and 2 deletions
|
@ -952,7 +952,7 @@ bool cpu_thread::check_state() noexcept
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state0 & cpu_flag::yield && cpu_flag::wait - state0 && cpu_can_stop)
|
if (state0 & cpu_flag::yield && cpu_can_stop)
|
||||||
{
|
{
|
||||||
if (auto spu = try_get<spu_thread>())
|
if (auto spu = try_get<spu_thread>())
|
||||||
{
|
{
|
||||||
|
|
|
@ -1763,9 +1763,13 @@ void lv2_obj::schedule_all(u64 current_time)
|
||||||
if (target->state & cpu_flag::suspend)
|
if (target->state & cpu_flag::suspend)
|
||||||
{
|
{
|
||||||
ppu_log.trace("schedule(): %s", target->id);
|
ppu_log.trace("schedule(): %s", target->id);
|
||||||
|
|
||||||
|
// Remove yield if it was sleeping until now
|
||||||
|
const bs_t<cpu_flag> remove_yield = target->start_time == 0 ? +cpu_flag::suspend : (cpu_flag::yield + cpu_flag::preempt);
|
||||||
|
|
||||||
target->start_time = 0;
|
target->start_time = 0;
|
||||||
|
|
||||||
if ((target->state.fetch_op(FN(x += cpu_flag::signal, x -= cpu_flag::suspend, void())) & (cpu_flag::wait + cpu_flag::signal)) != cpu_flag::wait)
|
if ((target->state.fetch_op(FN(x += cpu_flag::signal, x -= cpu_flag::suspend, x-= remove_yield, void())) & (cpu_flag::wait + cpu_flag::signal)) != cpu_flag::wait)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue