1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-11-26 22:02:15 +00:00

kern: fix assertion in KThread::(Try)Suspend

This commit is contained in:
Michael Scire 2020-07-25 03:12:09 -07:00 committed by SciresM
parent 0af44d2875
commit 1448068b69
2 changed files with 3 additions and 2 deletions

View file

@ -445,6 +445,7 @@ namespace ams::kern {
constexpr u32 GetSuspendFlags() const { return this->suspend_allowed_flags & this->suspend_request_flags; }
constexpr bool IsSuspended() const { return this->GetSuspendFlags() != 0; }
constexpr bool IsSuspendRequested(SuspendType type) const { return (this->suspend_request_flags & (1u << (ThreadState_SuspendShift + type))) != 0; }
constexpr bool IsSuspendRequested() const { return this->suspend_request_flags != 0; }
void RequestSuspend(SuspendType type);
void Resume(SuspendType type);
void TrySuspend();

View file

@ -576,7 +576,7 @@ namespace ams::kern {
void KThread::TrySuspend() {
MESOSPHERE_ASSERT_THIS();
MESOSPHERE_ASSERT(KScheduler::IsSchedulerLockedByCurrentThread());
MESOSPHERE_ASSERT(this->IsSuspended());
MESOSPHERE_ASSERT(this->IsSuspendRequested());
/* Ensure that we have no waiters. */
if (this->GetNumKernelWaiters() > 0) {
@ -591,7 +591,7 @@ namespace ams::kern {
void KThread::Suspend() {
MESOSPHERE_ASSERT_THIS();
MESOSPHERE_ASSERT(KScheduler::IsSchedulerLockedByCurrentThread());
MESOSPHERE_ASSERT(this->IsSuspended());
MESOSPHERE_ASSERT(this->IsSuspendRequested());
/* Set our suspend flags in state. */
const auto old_state = this->thread_state;