Kernel/SVC: Pass the current thread as a parameter to ClientSession::SendSyncRequest.

This commit is contained in:
Subv 2017-06-29 12:30:34 -05:00
parent c3c9175a1c
commit b53fa9514f
3 changed files with 7 additions and 4 deletions

View file

@ -9,6 +9,7 @@
#include "core/hle/kernel/hle_ipc.h"
#include "core/hle/kernel/server_session.h"
#include "core/hle/kernel/session.h"
#include "core/hle/kernel/thread.h"
namespace Kernel {
@ -37,14 +38,14 @@ ClientSession::~ClientSession() {
parent->client = nullptr;
}
ResultCode ClientSession::SendSyncRequest() {
ResultCode ClientSession::SendSyncRequest(SharedPtr<Thread> thread) {
// Keep ServerSession alive until we're done working with it.
SharedPtr<ServerSession> server = parent->server;
if (server == nullptr)
return ERR_SESSION_CLOSED_BY_REMOTE;
// Signal the server session that new data is available
return server->HandleSyncRequest(GetCurrentThread());
return server->HandleSyncRequest(std::move(thread));
}
} // namespace

View file

@ -14,6 +14,7 @@ namespace Kernel {
class ServerSession;
class Session;
class Thread;
class ClientSession final : public Object {
public:
@ -34,9 +35,10 @@ public:
/**
* Sends an SyncRequest from the current emulated thread.
* @param thread Thread that initiated the request.
* @return ResultCode of the operation.
*/
ResultCode SendSyncRequest();
ResultCode SendSyncRequest(SharedPtr<Thread> thread);
std::string name; ///< Name of client port (optional)

View file

@ -237,7 +237,7 @@ static ResultCode SendSyncRequest(Kernel::Handle handle) {
// TODO(Subv): svcSendSyncRequest should put the caller thread to sleep while the server
// responds and cause a reschedule.
return session->SendSyncRequest();
return session->SendSyncRequest(Kernel::GetCurrentThread());
}
/// Close a handle