summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel/hle_ipc.cpp
diff options
context:
space:
mode:
authorFernando Sahmkow <fsahmkow27@gmail.com>2020-03-03 18:02:50 +0100
committerFernando Sahmkow <fsahmkow27@gmail.com>2020-06-27 17:35:22 +0200
commit75e10578f12cf64bd734388ba80b5f5a46ca6133 (patch)
tree4ba3fa4053193e03407dbfdd6d9d742537406000 /src/core/hle/kernel/hle_ipc.cpp
parentProcess: Protect TLS region and Modules. (diff)
downloadyuzu-75e10578f12cf64bd734388ba80b5f5a46ca6133.tar
yuzu-75e10578f12cf64bd734388ba80b5f5a46ca6133.tar.gz
yuzu-75e10578f12cf64bd734388ba80b5f5a46ca6133.tar.bz2
yuzu-75e10578f12cf64bd734388ba80b5f5a46ca6133.tar.lz
yuzu-75e10578f12cf64bd734388ba80b5f5a46ca6133.tar.xz
yuzu-75e10578f12cf64bd734388ba80b5f5a46ca6133.tar.zst
yuzu-75e10578f12cf64bd734388ba80b5f5a46ca6133.zip
Diffstat (limited to 'src/core/hle/kernel/hle_ipc.cpp')
-rw-r--r--src/core/hle/kernel/hle_ipc.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/core/hle/kernel/hle_ipc.cpp b/src/core/hle/kernel/hle_ipc.cpp
index 955d5fe1c..e74d91670 100644
--- a/src/core/hle/kernel/hle_ipc.cpp
+++ b/src/core/hle/kernel/hle_ipc.cpp
@@ -21,8 +21,8 @@
#include "core/hle/kernel/object.h"
#include "core/hle/kernel/process.h"
#include "core/hle/kernel/readable_event.h"
-#include "core/hle/kernel/server_session.h"
#include "core/hle/kernel/scheduler.h"
+#include "core/hle/kernel/server_session.h"
#include "core/hle/kernel/thread.h"
#include "core/hle/kernel/time_manager.h"
#include "core/hle/kernel/writable_event.h"
@@ -49,14 +49,6 @@ std::shared_ptr<WritableEvent> HLERequestContext::SleepClientThread(
const std::string& reason, u64 timeout, WakeupCallback&& callback,
std::shared_ptr<WritableEvent> writable_event) {
// Put the client thread to sleep until the wait event is signaled or the timeout expires.
- thread->SetHLECallback(
- [context = *this, callback](ThreadWakeupReason reason, std::shared_ptr<Thread> thread,
- std::shared_ptr<SynchronizationObject> object,
- std::size_t index) mutable -> bool {
- callback(thread, context, reason);
- context.WriteToOutgoingCommandBuffer(*thread);
- return true;
- });
if (!writable_event) {
// Create event if not provided
@@ -67,6 +59,15 @@ std::shared_ptr<WritableEvent> HLERequestContext::SleepClientThread(
{
Handle event_handle = InvalidHandle;
SchedulerLockAndSleep lock(kernel, event_handle, thread.get(), timeout);
+ thread->SetHLECallback(
+ [context = *this, callback](std::shared_ptr<Thread> thread) mutable -> bool {
+ ThreadWakeupReason reason = thread->GetSignalingResult() == RESULT_TIMEOUT
+ ? ThreadWakeupReason::Timeout
+ : ThreadWakeupReason::Signal;
+ callback(thread, context, reason);
+ context.WriteToOutgoingCommandBuffer(*thread);
+ return true;
+ });
const auto readable_event{writable_event->GetReadableEvent()};
writable_event->Clear();
thread->SetStatus(ThreadStatus::WaitHLEEvent);