HLE: Use std::chrono::nanoseconds instead of a plain u64 in SleepClientThread.
This commit is contained in:
parent
2052a201c0
commit
b0f4390247
|
@ -26,7 +26,8 @@ void SessionRequestHandler::ClientDisconnected(SharedPtr<ServerSession> server_s
|
||||||
}
|
}
|
||||||
|
|
||||||
SharedPtr<Event> HLERequestContext::SleepClientThread(SharedPtr<Thread> thread,
|
SharedPtr<Event> HLERequestContext::SleepClientThread(SharedPtr<Thread> thread,
|
||||||
const std::string& reason, u64 timeout,
|
const std::string& reason,
|
||||||
|
std::chrono::nanoseconds timeout,
|
||||||
WakeupCallback&& callback) {
|
WakeupCallback&& callback) {
|
||||||
// Put the client thread to sleep until the wait event is signaled or the timeout expires.
|
// Put the client thread to sleep until the wait event is signaled or the timeout expires.
|
||||||
thread->wakeup_callback = [ context = *this, callback ](
|
thread->wakeup_callback = [ context = *this, callback ](
|
||||||
|
@ -52,8 +53,8 @@ SharedPtr<Event> HLERequestContext::SleepClientThread(SharedPtr<Thread> thread,
|
||||||
thread->wait_objects = {event};
|
thread->wait_objects = {event};
|
||||||
event->AddWaitingThread(thread);
|
event->AddWaitingThread(thread);
|
||||||
|
|
||||||
if (timeout > 0)
|
if (timeout.count() > 0)
|
||||||
thread->WakeAfterDelay(timeout);
|
thread->WakeAfterDelay(timeout.count());
|
||||||
|
|
||||||
return event;
|
return event;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
|
#include <chrono>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
@ -146,7 +147,7 @@ public:
|
||||||
using WakeupCallback = std::function<void(SharedPtr<Thread> thread, HLERequestContext& context,
|
using WakeupCallback = std::function<void(SharedPtr<Thread> thread, HLERequestContext& context,
|
||||||
ThreadWakeupReason reason)>;
|
ThreadWakeupReason reason)>;
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Puts the specified guest thread to sleep until the returned event is signaled or until the
|
* Puts the specified guest thread to sleep until the returned event is signaled or until the
|
||||||
* specified timeout expires.
|
* specified timeout expires.
|
||||||
* @param thread Thread to be put to sleep.
|
* @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.
|
* @returns Event that when signaled will resume the thread and call the callback function.
|
||||||
*/
|
*/
|
||||||
SharedPtr<Event> SleepClientThread(SharedPtr<Thread> thread, const std::string& reason,
|
SharedPtr<Event> SleepClientThread(SharedPtr<Thread> 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
|
* Resolves a object id from the request command buffer into a pointer to an object. See the
|
||||||
|
|
Loading…
Reference in New Issue