kern: implement SvcCancelSynchronization

This commit is contained in:
Michael Scire authored and SciresM committed 2020-07-31 14:50:52 -07:00
1 parent 5b8a20dbf7
commit 26df56cd87
3 files changed
+35 -2

No files matched your search

@@ -439,6 +439,27 @@ namespace ams::kern {
}
}
void KThread::WaitCancel() {
MESOSPHERE_ASSERT_THIS();
KScopedSchedulerLock sl;
/* Check if we're waiting and cancellable. */
if (this->GetState() == ThreadState_Waiting && this->cancellable) {
if (this->sleeping_queue != nullptr) {
/* TODO: Cancel light IPC. */
MESOSPHERE_UNIMPLEMENTED();
} else {
this->SetSyncedObject(nullptr, svc::ResultCancelled());
this->SetState(ThreadState_Runnable);
this->wait_cancelled = false;
}
} else {
/* Otherwise, note that we cancelled a wait. */
this->wait_cancelled = true;
}
}
void KThread::TrySuspend() {
MESOSPHERE_ASSERT_THIS();
MESOSPHERE_ASSERT(KScheduler::IsSchedulerLockedByCurrentThread());