summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel/svc.cpp
diff options
context:
space:
mode:
authorFernando Sahmkow <fsahmkow27@gmail.com>2020-02-26 00:43:28 +0100
committerFernando Sahmkow <fsahmkow27@gmail.com>2020-06-27 17:35:14 +0200
commit15a79eb0d7abe752a9a55d0cfa7ea220e17318b7 (patch)
tree863357ab4be1ff9a72804c40455d6a4c4c493acd /src/core/hle/kernel/svc.cpp
parentSVC: Correct ArbitrateUnlock (diff)
downloadyuzu-15a79eb0d7abe752a9a55d0cfa7ea220e17318b7.tar
yuzu-15a79eb0d7abe752a9a55d0cfa7ea220e17318b7.tar.gz
yuzu-15a79eb0d7abe752a9a55d0cfa7ea220e17318b7.tar.bz2
yuzu-15a79eb0d7abe752a9a55d0cfa7ea220e17318b7.tar.lz
yuzu-15a79eb0d7abe752a9a55d0cfa7ea220e17318b7.tar.xz
yuzu-15a79eb0d7abe752a9a55d0cfa7ea220e17318b7.tar.zst
yuzu-15a79eb0d7abe752a9a55d0cfa7ea220e17318b7.zip
Diffstat (limited to 'src/core/hle/kernel/svc.cpp')
-rw-r--r--src/core/hle/kernel/svc.cpp21
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 @@
#include "core/hle/kernel/svc_wrap.h"
#include "core/hle/kernel/synchronization.h"
#include "core/hle/kernel/thread.h"
+#include "core/hle/kernel/time_manager.h"
#include "core/hle/kernel/transfer_memory.h"
#include "core/hle/kernel/writable_event.h"
#include "core/hle/lock.h"
@@ -318,11 +319,23 @@ static ResultCode SendSyncRequest(Core::System& system, Handle handle) {
LOG_TRACE(Kernel_SVC, "called handle=0x{:08X}({})", handle, session->GetName());
auto thread = system.CurrentScheduler().GetCurrentThread();
- thread->InvalidateWakeupCallback();
- thread->SetStatus(ThreadStatus::WaitIPC);
- system.PrepareReschedule(thread->GetProcessorID());
+ {
+ SchedulerLock lock(system.Kernel());
+ thread->InvalidateHLECallback();
+ thread->SetStatus(ThreadStatus::WaitIPC);
+ session->SendSyncRequest(SharedFrom(thread), system.Memory());
+ }
+ ResultCode result = thread->GetSignalingResult();
+ if (thread->HasHLECallback()) {
+ Handle event_handle = thread->GetHLETimeEvent();
+ if (event_handle != InvalidHandle) {
+ auto& time_manager = system.Kernel().TimeManager();
+ time_manager.UnscheduleTimeEvent(event_handle);
+ }
+ thread->InvokeHLECallback(ThreadWakeupReason::Timeout, SharedFrom(thread), nullptr, 0);
+ }
- return session->SendSyncRequest(SharedFrom(thread), system.Memory());
+ return result;
}
static ResultCode SendSyncRequest32(Core::System& system, Handle handle) {