diff options
author | Lioncash <mathew1800@gmail.com> | 2019-04-06 07:41:43 +0200 |
---|---|---|
committer | Lioncash <mathew1800@gmail.com> | 2019-04-06 07:42:03 +0200 |
commit | 7a7ffa602d9cae6f5fb25b83d5a107e576d82b06 (patch) | |
tree | a599221fe5fea442ca6e488f2fae7b0eab4d0c2d /src/core | |
parent | kernel/server_port: Return a std::pair from CreatePortPair() (diff) | |
download | yuzu-7a7ffa602d9cae6f5fb25b83d5a107e576d82b06.tar yuzu-7a7ffa602d9cae6f5fb25b83d5a107e576d82b06.tar.gz yuzu-7a7ffa602d9cae6f5fb25b83d5a107e576d82b06.tar.bz2 yuzu-7a7ffa602d9cae6f5fb25b83d5a107e576d82b06.tar.lz yuzu-7a7ffa602d9cae6f5fb25b83d5a107e576d82b06.tar.xz yuzu-7a7ffa602d9cae6f5fb25b83d5a107e576d82b06.tar.zst yuzu-7a7ffa602d9cae6f5fb25b83d5a107e576d82b06.zip |
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/hle/ipc_helpers.h | 4 | ||||
-rw-r--r-- | src/core/hle/kernel/client_port.cpp | 10 | ||||
-rw-r--r-- | src/core/hle/kernel/server_session.cpp | 2 | ||||
-rw-r--r-- | src/core/hle/kernel/server_session.h | 3 |
4 files changed, 8 insertions, 11 deletions
diff --git a/src/core/hle/ipc_helpers.h b/src/core/hle/ipc_helpers.h index 68406eb63..ac0e1d796 100644 --- a/src/core/hle/ipc_helpers.h +++ b/src/core/hle/ipc_helpers.h @@ -139,10 +139,8 @@ public: context->AddDomainObject(std::move(iface)); } else { auto& kernel = Core::System::GetInstance().Kernel(); - auto sessions = + auto [server, client] = Kernel::ServerSession::CreateSessionPair(kernel, iface->GetServiceName()); - auto server = std::get<Kernel::SharedPtr<Kernel::ServerSession>>(sessions); - auto client = std::get<Kernel::SharedPtr<Kernel::ClientSession>>(sessions); iface->ClientConnected(server); context->AddMoveObject(std::move(client)); } diff --git a/src/core/hle/kernel/client_port.cpp b/src/core/hle/kernel/client_port.cpp index aa432658e..744b1697d 100644 --- a/src/core/hle/kernel/client_port.cpp +++ b/src/core/hle/kernel/client_port.cpp @@ -2,8 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include <tuple> - #include "core/hle/kernel/client_port.h" #include "core/hle/kernel/client_session.h" #include "core/hle/kernel/errors.h" @@ -31,18 +29,18 @@ ResultVal<SharedPtr<ClientSession>> ClientPort::Connect() { active_sessions++; // Create a new session pair, let the created sessions inherit the parent port's HLE handler. - auto sessions = ServerSession::CreateSessionPair(kernel, server_port->GetName(), this); + auto [server, client] = ServerSession::CreateSessionPair(kernel, server_port->GetName(), this); if (server_port->HasHLEHandler()) { - server_port->GetHLEHandler()->ClientConnected(std::get<SharedPtr<ServerSession>>(sessions)); + server_port->GetHLEHandler()->ClientConnected(server); } else { - server_port->AppendPendingSession(std::get<SharedPtr<ServerSession>>(sessions)); + server_port->AppendPendingSession(server); } // Wake the threads waiting on the ServerPort server_port->WakeupAllWaitingThreads(); - return MakeResult(std::get<SharedPtr<ClientSession>>(sessions)); + return MakeResult(client); } void ClientPort::ConnectionClosed() { diff --git a/src/core/hle/kernel/server_session.cpp b/src/core/hle/kernel/server_session.cpp index 40cec143e..a6b2cf06a 100644 --- a/src/core/hle/kernel/server_session.cpp +++ b/src/core/hle/kernel/server_session.cpp @@ -204,6 +204,6 @@ ServerSession::SessionPair ServerSession::CreateSessionPair(KernelCore& kernel, client_session->parent = parent; server_session->parent = parent; - return std::make_tuple(std::move(server_session), std::move(client_session)); + return std::make_pair(std::move(server_session), std::move(client_session)); } } // namespace Kernel diff --git a/src/core/hle/kernel/server_session.h b/src/core/hle/kernel/server_session.h index 3429a326f..09b835ff8 100644 --- a/src/core/hle/kernel/server_session.h +++ b/src/core/hle/kernel/server_session.h @@ -6,6 +6,7 @@ #include <memory> #include <string> +#include <utility> #include <vector> #include "core/hle/kernel/object.h" @@ -58,7 +59,7 @@ public: return parent.get(); } - using SessionPair = std::tuple<SharedPtr<ServerSession>, SharedPtr<ClientSession>>; + using SessionPair = std::pair<SharedPtr<ServerSession>, SharedPtr<ClientSession>>; /** * Creates a pair of ServerSession and an associated ClientSession. |