Improve cpu_flag::yield handling
This commit is contained in:
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user