summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/kernel/hle_ipc.cpp37
-rw-r--r--src/core/hle/kernel/hle_ipc.h17
2 files changed, 0 insertions, 54 deletions
diff --git a/src/core/hle/kernel/hle_ipc.cpp b/src/core/hle/kernel/hle_ipc.cpp
index e75e80ad0..83decf6cf 100644
--- a/src/core/hle/kernel/hle_ipc.cpp
+++ b/src/core/hle/kernel/hle_ipc.cpp
@@ -46,43 +46,6 @@ void SessionRequestHandler::ClientDisconnected(
46 boost::range::remove_erase(connected_sessions, server_session); 46 boost::range::remove_erase(connected_sessions, server_session);
47} 47}
48 48
49std::shared_ptr<WritableEvent> HLERequestContext::SleepClientThread(
50 const std::string& reason, u64 timeout, WakeupCallback&& callback,
51 std::shared_ptr<WritableEvent> writable_event) {
52 // Put the client thread to sleep until the wait event is signaled or the timeout expires.
53
54 if (!writable_event) {
55 // Create event if not provided
56 const auto pair = WritableEvent::CreateEventPair(kernel, "HLE Pause Event: " + reason);
57 writable_event = pair.writable;
58 }
59
60 Handle event_handle = InvalidHandle;
61 {
62 KScopedSchedulerLockAndSleep lock(kernel, event_handle, thread.get(), timeout);
63 thread->SetHLECallback(
64 [context = *this, callback](std::shared_ptr<Thread> thread) mutable -> bool {
65 ThreadWakeupReason reason = thread->GetSignalingResult() == RESULT_TIMEOUT
66 ? ThreadWakeupReason::Timeout
67 : ThreadWakeupReason::Signal;
68 callback(thread, context, reason);
69 context.WriteToOutgoingCommandBuffer(*thread);
70 return true;
71 });
72 const auto readable_event{writable_event->GetReadableEvent()};
73 writable_event->Clear();
74 thread->SetHLESyncObject(readable_event.get());
75 thread->SetStatus(ThreadStatus::WaitHLEEvent);
76 thread->SetSynchronizationResults(nullptr, RESULT_TIMEOUT);
77 readable_event->AddWaitingThread(thread);
78 }
79 thread->SetHLETimeEvent(event_handle);
80
81 is_thread_waiting = true;
82
83 return writable_event;
84}
85
86HLERequestContext::HLERequestContext(KernelCore& kernel, Core::Memory::Memory& memory, 49HLERequestContext::HLERequestContext(KernelCore& kernel, Core::Memory::Memory& memory,
87 std::shared_ptr<ServerSession> server_session, 50 std::shared_ptr<ServerSession> server_session,
88 std::shared_ptr<Thread> thread) 51 std::shared_ptr<Thread> thread)
diff --git a/src/core/hle/kernel/hle_ipc.h b/src/core/hle/kernel/hle_ipc.h
index c31a65476..b112e1ebd 100644
--- a/src/core/hle/kernel/hle_ipc.h
+++ b/src/core/hle/kernel/hle_ipc.h
@@ -129,23 +129,6 @@ public:
129 using WakeupCallback = std::function<void( 129 using WakeupCallback = std::function<void(
130 std::shared_ptr<Thread> thread, HLERequestContext& context, ThreadWakeupReason reason)>; 130 std::shared_ptr<Thread> thread, HLERequestContext& context, ThreadWakeupReason reason)>;
131 131
132 /**
133 * Puts the specified guest thread to sleep until the returned event is signaled or until the
134 * specified timeout expires.
135 * @param reason Reason for pausing the thread, to be used for debugging purposes.
136 * @param timeout Timeout in nanoseconds after which the thread will be awoken and the callback
137 * invoked with a Timeout reason.
138 * @param callback Callback to be invoked when the thread is resumed. This callback must write
139 * the entire command response once again, regardless of the state of it before this function
140 * was called.
141 * @param writable_event Event to use to wake up the thread. If unspecified, an event will be
142 * created.
143 * @returns Event that when signaled will resume the thread and call the callback function.
144 */
145 std::shared_ptr<WritableEvent> SleepClientThread(
146 const std::string& reason, u64 timeout, WakeupCallback&& callback,
147 std::shared_ptr<WritableEvent> writable_event = nullptr);
148
149 /// Populates this context with data from the requesting process/thread. 132 /// Populates this context with data from the requesting process/thread.
150 ResultCode PopulateFromIncomingCommandBuffer(const HandleTable& handle_table, 133 ResultCode PopulateFromIncomingCommandBuffer(const HandleTable& handle_table,
151 u32_le* src_cmdbuf); 134 u32_le* src_cmdbuf);