diff options
author | Zach Hilman <zachhilman@gmail.com> | 2018-11-22 06:33:53 +0100 |
---|---|---|
committer | Zach Hilman <zachhilman@gmail.com> | 2018-11-22 06:33:53 +0100 |
commit | 820d81b9a5392951c18daa5a47d6c0ffd28baa9b (patch) | |
tree | dab20f1ff49ab76cdcd511e189799f4d6e40677e /src/core/hle/kernel/svc.cpp | |
parent | svc: Implement yield types 0 and -1 (diff) | |
download | yuzu-820d81b9a5392951c18daa5a47d6c0ffd28baa9b.tar yuzu-820d81b9a5392951c18daa5a47d6c0ffd28baa9b.tar.gz yuzu-820d81b9a5392951c18daa5a47d6c0ffd28baa9b.tar.bz2 yuzu-820d81b9a5392951c18daa5a47d6c0ffd28baa9b.tar.lz yuzu-820d81b9a5392951c18daa5a47d6c0ffd28baa9b.tar.xz yuzu-820d81b9a5392951c18daa5a47d6c0ffd28baa9b.tar.zst yuzu-820d81b9a5392951c18daa5a47d6c0ffd28baa9b.zip |
Diffstat (limited to 'src/core/hle/kernel/svc.cpp')
-rw-r--r-- | src/core/hle/kernel/svc.cpp | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index 467575c93..205706033 100644 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp @@ -965,16 +965,23 @@ static void SleepThread(s64 nanoseconds) { if (!Core::System::GetInstance().CurrentScheduler().HaveReadyThreads()) return; + enum class SleepType : s64 { + YieldWithoutLoadBalancing = 0, + YieldWithLoadBalancing = 1, + YieldAndWaitForLoadBalancing = 2, + }; + if (nanoseconds <= 0) { - switch (nanoseconds) { - case 0: - GetCurrentThread()->YieldNormal(); + auto& scheduler{Core::System::GetInstance().CurrentScheduler()}; + switch (static_cast<SleepType>(nanoseconds)) { + case SleepType::YieldWithoutLoadBalancing: + scheduler.YieldWithoutLoadBalancing(GetCurrentThread()); break; - case -1: - GetCurrentThread()->YieldWithLoadBalancing(); + case SleepType::YieldWithLoadBalancing: + scheduler.YieldWithLoadBalancing(GetCurrentThread()); break; - case -2: - GetCurrentThread()->YieldAndWaitForLoadBalancing(); + case SleepType::YieldAndWaitForLoadBalancing: + scheduler.YieldAndWaitForLoadBalancing(GetCurrentThread()); break; default: UNREACHABLE_MSG( |