diff options
Diffstat (limited to 'src/core/hle/kernel/svc.cpp')
| -rw-r--r-- | src/core/hle/kernel/svc.cpp | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index 0d905c0ca..768d72b92 100644 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp | |||
| @@ -38,6 +38,7 @@ | |||
| 38 | #include "core/hle/kernel/svc_wrap.h" | 38 | #include "core/hle/kernel/svc_wrap.h" |
| 39 | #include "core/hle/kernel/synchronization.h" | 39 | #include "core/hle/kernel/synchronization.h" |
| 40 | #include "core/hle/kernel/thread.h" | 40 | #include "core/hle/kernel/thread.h" |
| 41 | #include "core/hle/kernel/time_manager.h" | ||
| 41 | #include "core/hle/kernel/transfer_memory.h" | 42 | #include "core/hle/kernel/transfer_memory.h" |
| 42 | #include "core/hle/kernel/writable_event.h" | 43 | #include "core/hle/kernel/writable_event.h" |
| 43 | #include "core/hle/lock.h" | 44 | #include "core/hle/lock.h" |
| @@ -318,11 +319,23 @@ static ResultCode SendSyncRequest(Core::System& system, Handle handle) { | |||
| 318 | LOG_TRACE(Kernel_SVC, "called handle=0x{:08X}({})", handle, session->GetName()); | 319 | LOG_TRACE(Kernel_SVC, "called handle=0x{:08X}({})", handle, session->GetName()); |
| 319 | 320 | ||
| 320 | auto thread = system.CurrentScheduler().GetCurrentThread(); | 321 | auto thread = system.CurrentScheduler().GetCurrentThread(); |
| 321 | thread->InvalidateWakeupCallback(); | 322 | { |
| 322 | thread->SetStatus(ThreadStatus::WaitIPC); | 323 | SchedulerLock lock(system.Kernel()); |
| 323 | system.PrepareReschedule(thread->GetProcessorID()); | 324 | thread->InvalidateHLECallback(); |
| 325 | thread->SetStatus(ThreadStatus::WaitIPC); | ||
| 326 | session->SendSyncRequest(SharedFrom(thread), system.Memory()); | ||
| 327 | } | ||
| 328 | ResultCode result = thread->GetSignalingResult(); | ||
| 329 | if (thread->HasHLECallback()) { | ||
| 330 | Handle event_handle = thread->GetHLETimeEvent(); | ||
| 331 | if (event_handle != InvalidHandle) { | ||
| 332 | auto& time_manager = system.Kernel().TimeManager(); | ||
| 333 | time_manager.UnscheduleTimeEvent(event_handle); | ||
| 334 | } | ||
| 335 | thread->InvokeHLECallback(ThreadWakeupReason::Timeout, SharedFrom(thread), nullptr, 0); | ||
| 336 | } | ||
| 324 | 337 | ||
| 325 | return session->SendSyncRequest(SharedFrom(thread), system.Memory()); | 338 | return result; |
| 326 | } | 339 | } |
| 327 | 340 | ||
| 328 | static ResultCode SendSyncRequest32(Core::System& system, Handle handle) { | 341 | static ResultCode SendSyncRequest32(Core::System& system, Handle handle) { |