From 323a0e17e7b656ce5f7ea7e2710d4d4fae27bb74 Mon Sep 17 00:00:00 2001 From: Fernando Sahmkow Date: Sat, 16 Nov 2019 11:05:39 -0400 Subject: Kernel: Correct Cancel Synchronization. This commit corrects the behavior of cancel synchronization when the thread is running/ready and ensures the next wait is cancelled as it's suppose to. --- src/core/hle/kernel/thread.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/core/hle/kernel/thread.cpp') diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp index 962530d2d2..538e479922 100644 --- a/src/core/hle/kernel/thread.cpp +++ b/src/core/hle/kernel/thread.cpp @@ -132,8 +132,11 @@ void Thread::ResumeFromWait() { } void Thread::CancelWait() { - ASSERT(GetStatus() == ThreadStatus::WaitSynch); - ClearWaitObjects(); + if (GetSchedulingStatus() != ThreadSchedStatus::Paused) { + is_sync_cancelled = true; + return; + } + is_sync_cancelled = false; SetWaitSynchronizationResult(ERR_SYNCHRONIZATION_CANCELED); ResumeFromWait(); } -- cgit v1.2.3