summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2019-04-17 13:08:12 +0200
committerLioncash <mathew1800@gmail.com>2019-04-17 15:30:56 +0200
commit433b59c1121a257ae3c1503fff5b71d3f3852ab5 (patch)
tree23f4cbe699ff28d3f5907aff55f49081623d419b
parentMerge pull request #2315 from ReinUsesLisp/severity-decompiler (diff)
downloadyuzu-433b59c1121a257ae3c1503fff5b71d3f3852ab5.tar
yuzu-433b59c1121a257ae3c1503fff5b71d3f3852ab5.tar.gz
yuzu-433b59c1121a257ae3c1503fff5b71d3f3852ab5.tar.bz2
yuzu-433b59c1121a257ae3c1503fff5b71d3f3852ab5.tar.lz
yuzu-433b59c1121a257ae3c1503fff5b71d3f3852ab5.tar.xz
yuzu-433b59c1121a257ae3c1503fff5b71d3f3852ab5.tar.zst
yuzu-433b59c1121a257ae3c1503fff5b71d3f3852ab5.zip
-rw-r--r--src/core/hle/kernel/svc.cpp6
-rw-r--r--src/core/hle/kernel/thread.cpp6
-rw-r--r--src/core/hle/kernel/thread.h12
3 files changed, 17 insertions, 7 deletions
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp
index d48a2203a..b25190882 100644
--- a/src/core/hle/kernel/svc.cpp
+++ b/src/core/hle/kernel/svc.cpp
@@ -518,16 +518,14 @@ static ResultCode CancelSynchronization(Core::System& system, Handle thread_hand
LOG_TRACE(Kernel_SVC, "called thread=0x{:X}", thread_handle);
const auto& handle_table = system.Kernel().CurrentProcess()->GetHandleTable();
- const SharedPtr<Thread> thread = handle_table.Get<Thread>(thread_handle);
+ SharedPtr<Thread> thread = handle_table.Get<Thread>(thread_handle);
if (!thread) {
LOG_ERROR(Kernel_SVC, "Thread handle does not exist, thread_handle=0x{:08X}",
thread_handle);
return ERR_INVALID_HANDLE;
}
- ASSERT(thread->GetStatus() == ThreadStatus::WaitSynchAny);
- thread->SetWaitSynchronizationResult(ERR_SYNCHRONIZATION_CANCELED);
- thread->ResumeFromWait();
+ thread->CancelWait();
return RESULT_SUCCESS;
}
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp
index ca52267b2..7d4fe9608 100644
--- a/src/core/hle/kernel/thread.cpp
+++ b/src/core/hle/kernel/thread.cpp
@@ -142,6 +142,12 @@ void Thread::ResumeFromWait() {
ChangeScheduler();
}
+void Thread::CancelWait() {
+ ASSERT(GetStatus() == ThreadStatus::WaitSynchAny);
+ SetWaitSynchronizationResult(ERR_SYNCHRONIZATION_CANCELED);
+ ResumeFromWait();
+}
+
/**
* Resets a thread context, making it ready to be scheduled and run by the CPU
* @param context Thread context to reset
diff --git a/src/core/hle/kernel/thread.h b/src/core/hle/kernel/thread.h
index 32026d7f0..e3c457408 100644
--- a/src/core/hle/kernel/thread.h
+++ b/src/core/hle/kernel/thread.h
@@ -164,11 +164,17 @@ public:
return tls_memory;
}
- /**
- * Resumes a thread from waiting
- */
+ /// Resumes a thread from waiting
void ResumeFromWait();
+ /// Cancels a waiting operation that this thread may or may not be within.
+ ///
+ /// When the thread is within a waiting state, this will set the thread's
+ /// waiting result to signal a canceled wait. The function will then resume
+ /// this thread.
+ ///
+ void CancelWait();
+
/**
* Schedules an event to wake up the specified thread after the specified delay
* @param nanoseconds The time this thread will be allowed to sleep for