meso: introduce ProcessState

This commit is contained in:
TuxSH authored and Michael Scire committed 2019-06-03 17:41:09 -07:00
1 parent 757aa30e74
commit 529024448e
3 files changed
+57 -2

No files matched your search

+31
View File
@@ -11,4 +11,35 @@ void KProcess::SetLastThreadAndIdleSelectionCount(KThread *thread, ulong idleSel
lastIdleSelectionCount[thread->GetCurrentCoreId()] = idleSelectionCount;
}
bool KProcess::IsSignaled() const
{
return stateChanged;
}
void KProcess::SetDebug(KDebug *debug)
{
this->debug = debug;
if (state != State::DebugSuspended) {
state = state == State::Created ? State::CreatedAttached : State::DebugSuspended;
stateChanged = true;
NotifyWaiters();
}
}
void KProcess::ClearDebug(KProcess::State attachState)
{
debug = nullptr;
State oldState = state;
if (state == State::StartedAttached || state == State::DebugSuspended) {
state = attachState == State::Created ? State::Started : attachState; // Restore the old state
} else if (state == State::CreatedAttached) {
state = State::Created;
}
if (state != oldState) {
stateChanged = true;
NotifyWaiters();
}
}
}