Implement cpu_flag::temp flag

Accompanies wait flag, indicating that it was set in limited conditions.
Such condition don't allow thread to terminate after its removal.
This commit is contained in:
Nekotekina 2020-10-25 20:06:34 +03:00
parent 18ca3ed449
commit 130a0ef20e
4 changed files with 20 additions and 11 deletions

View file

@ -531,6 +531,7 @@ bool cpu_thread::check_state() noexcept
}
bool cpu_sleep_called = false;
bool cpu_can_stop = true;
bool escape, retval;
u64 susp_ctr = -1;
@ -551,6 +552,14 @@ bool cpu_thread::check_state() noexcept
susp_ctr = -1;
}
if (flags & cpu_flag::temp)
{
// Sticky flag, indicates check_state() is not allowed to return true
flags -= cpu_flag::temp;
cpu_can_stop = false;
store = true;
}
if (flags & cpu_flag::signal)
{
flags -= cpu_flag::signal;
@ -580,7 +589,7 @@ bool cpu_thread::check_state() noexcept
store = true;
}
retval = false;
retval = !cpu_can_stop;
}
else
{
@ -593,8 +602,9 @@ bool cpu_thread::check_state() noexcept
retval = true;
}
if (flags & cpu_flag::dbg_step)
if (cpu_can_stop && flags & cpu_flag::dbg_step)
{
// Can't process dbg_step if we only paused temporarily
flags += cpu_flag::dbg_pause;
flags -= cpu_flag::dbg_step;
store = true;