From 8f108367c9280807236f2accc989da71a7bb674a Mon Sep 17 00:00:00 2001 From: Subv Date: Sun, 1 Oct 2017 22:09:00 -0500 Subject: [PATCH] Kernel/IPC: Put a thread to sleep when performing an LLE IPC request. It will be awoken when the server replies to the request via svcReplyAndReceive. --- src/core/hle/kernel/server_session.cpp | 3 +++ src/core/hle/svc.cpp | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/core/hle/kernel/server_session.cpp b/src/core/hle/kernel/server_session.cpp index 87d2d1ecb..bf2e9e376 100644 --- a/src/core/hle/kernel/server_session.cpp +++ b/src/core/hle/kernel/server_session.cpp @@ -63,6 +63,9 @@ ResultCode ServerSession::HandleSyncRequest(SharedPtr thread) { if (hle_handler != nullptr) { hle_handler->HandleSyncRequest(SharedPtr(this)); } else { + // Put the thread to sleep until the server replies, it will be awoken in + // svcReplyAndReceive. + thread->status = THREADSTATUS_WAIT_IPC; // Add the thread to the list of threads that have issued a sync request with this // server. pending_requesting_threads.push_back(std::move(thread)); diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp index fe06af8f8..34b44fce1 100644 --- a/src/core/hle/svc.cpp +++ b/src/core/hle/svc.cpp @@ -241,8 +241,6 @@ static ResultCode SendSyncRequest(Kernel::Handle handle) { Core::System::GetInstance().PrepareReschedule(); - // TODO(Subv): svcSendSyncRequest should put the caller thread to sleep while the server - // responds and cause a reschedule. return session->SendSyncRequest(Kernel::GetCurrentThread()); }