From b0f43902475fb109cf08c1c9f8250cf64d7929dd Mon Sep 17 00:00:00 2001 From: Subv Date: Wed, 21 Feb 2018 22:03:46 -0500 Subject: [PATCH] HLE: Use std::chrono::nanoseconds instead of a plain u64 in SleepClientThread. --- src/core/hle/kernel/hle_ipc.cpp | 7 ++++--- src/core/hle/kernel/hle_ipc.h | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/core/hle/kernel/hle_ipc.cpp b/src/core/hle/kernel/hle_ipc.cpp index 19d6d1bca4..60e19ed5cc 100644 --- a/src/core/hle/kernel/hle_ipc.cpp +++ b/src/core/hle/kernel/hle_ipc.cpp @@ -26,7 +26,8 @@ void SessionRequestHandler::ClientDisconnected(SharedPtr server_s } SharedPtr HLERequestContext::SleepClientThread(SharedPtr thread, - const std::string& reason, u64 timeout, + const std::string& reason, + std::chrono::nanoseconds timeout, WakeupCallback&& callback) { // Put the client thread to sleep until the wait event is signaled or the timeout expires. thread->wakeup_callback = [ context = *this, callback ]( @@ -52,8 +53,8 @@ SharedPtr HLERequestContext::SleepClientThread(SharedPtr thread, thread->wait_objects = {event}; event->AddWaitingThread(thread); - if (timeout > 0) - thread->WakeAfterDelay(timeout); + if (timeout.count() > 0) + thread->WakeAfterDelay(timeout.count()); return event; } diff --git a/src/core/hle/kernel/hle_ipc.h b/src/core/hle/kernel/hle_ipc.h index 856bb54be2..89928ac56a 100644 --- a/src/core/hle/kernel/hle_ipc.h +++ b/src/core/hle/kernel/hle_ipc.h @@ -5,6 +5,7 @@ #pragma once #include +#include #include #include #include @@ -146,7 +147,7 @@ public: using WakeupCallback = std::function thread, HLERequestContext& context, ThreadWakeupReason reason)>; - /* + /** * Puts the specified guest thread to sleep until the returned event is signaled or until the * specified timeout expires. * @param thread Thread to be put to sleep. @@ -159,7 +160,7 @@ public: * @returns Event that when signaled will resume the thread and call the callback function. */ SharedPtr SleepClientThread(SharedPtr thread, const std::string& reason, - u64 timeout, WakeupCallback&& callback); + std::chrono::nanoseconds timeout, WakeupCallback&& callback); /** * Resolves a object id from the request command buffer into a pointer to an object. See the