summaryrefslogtreecommitdiffstats
path: root/src/core/hle
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2021-11-10 06:02:29 +0100
committerbunnei <bunneidev@gmail.com>2021-12-07 01:39:17 +0100
commite942d9754028850ea1f6b223e4f1b8da7b13c1c4 (patch)
treeb58ff06d22144dfd13edd10ea7399b77f22da545 /src/core/hle
parenthle: kernel: KLightConditionVariable: Migrate to updated KThreadQueue. (diff)
downloadyuzu-e942d9754028850ea1f6b223e4f1b8da7b13c1c4.tar
yuzu-e942d9754028850ea1f6b223e4f1b8da7b13c1c4.tar.gz
yuzu-e942d9754028850ea1f6b223e4f1b8da7b13c1c4.tar.bz2
yuzu-e942d9754028850ea1f6b223e4f1b8da7b13c1c4.tar.lz
yuzu-e942d9754028850ea1f6b223e4f1b8da7b13c1c4.tar.xz
yuzu-e942d9754028850ea1f6b223e4f1b8da7b13c1c4.tar.zst
yuzu-e942d9754028850ea1f6b223e4f1b8da7b13c1c4.zip
Diffstat (limited to 'src/core/hle')
-rw-r--r--src/core/hle/kernel/k_server_session.cpp3
-rw-r--r--src/core/hle/kernel/svc.cpp13
2 files changed, 11 insertions, 5 deletions
diff --git a/src/core/hle/kernel/k_server_session.cpp b/src/core/hle/kernel/k_server_session.cpp
index 1f7220d48..d4e4a6b06 100644
--- a/src/core/hle/kernel/k_server_session.cpp
+++ b/src/core/hle/kernel/k_server_session.cpp
@@ -175,8 +175,7 @@ ResultCode KServerSession::CompleteSyncRequest(HLERequestContext& context) {
{
KScopedSchedulerLock lock(kernel);
if (!context.IsThreadWaiting()) {
- context.GetThread().Wakeup();
- context.GetThread().SetWaitResult(result);
+ context.GetThread().EndWait(result);
}
}
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp
index 50c6e513d..0e79e1be3 100644
--- a/src/core/hle/kernel/svc.cpp
+++ b/src/core/hle/kernel/svc.cpp
@@ -31,6 +31,7 @@
#include "core/hle/kernel/k_shared_memory.h"
#include "core/hle/kernel/k_synchronization_object.h"
#include "core/hle/kernel/k_thread.h"
+#include "core/hle/kernel/k_thread_queue.h"
#include "core/hle/kernel/k_transfer_memory.h"
#include "core/hle/kernel/k_writable_event.h"
#include "core/hle/kernel/kernel.h"
@@ -310,18 +311,24 @@ static ResultCode SendSyncRequest(Core::System& system, Handle handle) {
auto& kernel = system.Kernel();
+ // Create the wait queue.
+ KThreadQueue wait_queue(kernel);
+
auto thread = kernel.CurrentScheduler()->GetCurrentThread();
{
KScopedSchedulerLock lock(kernel);
- thread->SetState(ThreadState::Waiting);
- thread->SetWaitReasonForDebugging(ThreadWaitReasonForDebugging::IPC);
+
+ // This is a synchronous request, so we should wait for our request to complete.
+ GetCurrentThread(kernel).BeginWait(std::addressof(wait_queue));
+ GetCurrentThread(kernel).SetWaitReasonForDebugging(ThreadWaitReasonForDebugging::IPC);
{
KScopedAutoObject session =
kernel.CurrentProcess()->GetHandleTable().GetObject<KClientSession>(handle);
R_UNLESS(session.IsNotNull(), ResultInvalidHandle);
LOG_TRACE(Kernel_SVC, "called handle=0x{:08X}({})", handle, session->GetName());
- session->SendSyncRequest(thread, system.Memory(), system.CoreTiming());
+ session->SendSyncRequest(&GetCurrentThread(kernel), system.Memory(),
+ system.CoreTiming());
}
}